[Info-vax] F$GETQUI: the mystery deepens

Phillip Helbig undress to reply helbig at asclothestro.multivax.de
Fri Dec 7 14:35:53 EST 2018


I've always, let's say, had respect for F$GETQUI; it's powerful but can 
be somewhat cryptic.

Consider the following:

$    DUMMY = F$GETQUI("") !reset just in case
$QUEUE_NAME_LOOP:
$    QUEUE_NAME = F$GETQUI ("DISPLAY_QUEUE", "QUEUE_NAME", "*", "BATCH")
$    WRITE SYS$OUTPUT QUEUE_NAME
$    IF QUEUE_NAME .EQS. "" THEN GOTO END_QUEUE_NAME_LOOP
$!OK
$    SHOW QUEUE 'QUEUE_NAME'
$    IF F$GETQUI("DISPLAY_QUEUE","QUEUE_STOPPED",QUEUE_NAME,"FREEZE_CONTEXT") -
      .OR. -
      F$GETQUI("DISPLAY_QUEUE","QUEUE_PAUSED",QUEUE_NAME,"FREEZE_CONTEXT")
$    THEN
$!not OK
$!      SHOW QUEUE 'QUEUE_NAME'
$    ENDIF
$!not OK
$!    SHOW QUEUE 'QUEUE_NAME'
$GOTO QUEUE_NAME_LOOP
$END_QUEUE_NAME_LOOP:
$  EXIT

Perhaps one wants to make a list of queues which can't be started and/or
try to start them (in the IF block, rather than trying to start those
which are already started).  The comments show some possibilities where
the SHOW QUEUE command can be and whether it will work.

I don't think that it is uncommon to use F$GETQUI to get some
information then do SHOW QUEUE. 

When does SHOW QUEUE work?  When it is before the calls to F$GETQUI in 
the IF block, or when there is no IF block.  If it is after the IF 
block, the list starts from the beginning again when the loop is 
re-executed.  If there is no IF block, then there is the same behaviour.

It seems like SHOW QUEUE destroys the intended (at least, intended by 
me) behaviour, but further calls to F$GETQUI somehow reset this.

Bug or feature?

The original code had SHOW QUEUE in the IF block, then did START/QUEUE,
then another SHOW QUEUE.  It always "worked" in that it started all
unstarted queues.  However, it didn't work as intended, since what it 
did when a stopped queue was found was to start it (correct) but then 
start over at the beginning of the list, until the next stopped queue 
was found.  Obviously, it should continue until the list is exhausted.

The code didn't work when a node wasn't available, since the queues 
there couldn't be started.

The obvious workaround is 

   $  WRITE SYS$OUTPUT QUEUE_NAME

rather than

   $  SHOW QUEUE

at least if one needs just the name.

Thoughts?




More information about the Info-vax mailing list