From: carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick)
Newsgroups: comp.os.vms
Subject: Re: Problem(s) with F$GETQUI
Date: 19 Nov 1992 02:39:36 GMT
Organization: HST Wide Field/Planetary Camera
Distribution: world
Reply-To: carl@SOL1.GPS.CALTECH.EDU
NNTP-Posting-Host: sol1.gps.caltech.edu

In article <1992Nov18.170944.486@lrc.edu>, todd@lrc.edu writes:
>$ SHOW QUEUE/ALL
>$ IF P1 .EQS. "" THEN INQUIRE/NOPUNCTUATION P1 -
	"ENTER THE NAME OF THE JOB TO STOP> "
>$ ENTRY_NUMBER = F$INTEGER(F$GETQUI("DISPLAY_ENTRY","ENTRY_NUMBER",-
	P1,"ALL_JOBS"))
>$ WRITE SYS$OUTPUT "THE ENTRY NUMBER OF ", P1, " IS ", ENTRY_NUMBER, "."
>$ !DELETE/ENTRY = ENTRY_NUMBER
>
>Hi,
>     My name is Todd, and I am having the following problem when I use 
>the F$GETQUI utility.  When I call the utility in the above command 
>file, entry_number is always coming up to be 0.  I have used all sources of
>help for this problem... can anyone out there tell me the thing(s) that I am
>doing wrong?

Well, first of all, your definition of "all sources of help" and my definition
of the same phrase are worlds apart.  My definition, for example, includes using
the online help facility.  For example, one could issue the command:

$ HELP LEX F$GETQ FLAG

Lexicals

  F$GETQUI

    flags

         Specifies a list of keywords, separated by commas, that
         corresponds to the flags defined for the $GETQUI system service
         QUI$_SEARCH_FLAGS input item code. (These flags are used to
         define the scope of the object search specified in the call to
         the $GETQUI system service.) Note that the following keywords can
         be used only with certain function codes:

         Keyword             Valid Function Code   Description

         ALL_JOBS            DISPLAY_JOB           Requests that F$GETQUI
                                                   search all jobs included
                                                   in the established
                                                   queue context. If you
                                                   do not specify this
                                                   flag, F$GETQUI returns
                                                   information only about
                                                   jobs that have the same
                                                   user name as the caller.

You see, the ALL_JOBS flag has no effect at all when you use the DISPLAY_ENTRY
function code.  I guess reading the online help was just too much trouble.  Now,
armed with this bit of information along with example number 3 from the online
help for F$GETQUI, one can very easily construct the following DCL procedure:

$ SHOW QUEUE/ALL
$ IF P1 .EQS. "" THEN INQUIRE/NOPUNCTUATION P1 -
	"ENTER THE NAME OF THE JOB TO STOP> "
$! This command procedure loops all queues and the jobs in them.
$	TEMP = F$GETQUI("")
$ QLOOP:
$	QNAME = F$GETQUI("DISPLAY_QUEUE","QUEUE_NAME","*")
$	IF QNAME .EQS. "" THEN EXIT
$ JLOOP:
$	NOACCESS = F$GETQUI("DISPLAY_JOB","JOB_INACCESSIBLE",,"ALL_JOBS") 
$	IF NOACCESS .EQS. "TRUE" THEN GOTO JLOOP
$	IF NOACCESS .EQS. "" THEN GOTO QLOOP
$	JNAME = F$GETQUI("DISPLAY_JOB","JOB_NAME",,"FREEZE_CONTEXT,ALL_JOBS")
$	IF JNAME .NES. P1 THEN GOTO JLOOP
$	ENTRY_NUMBER = F$INTEGER(F$GETQUI("DISPLAY_JOB","ENTRY_NUMBER",,-
		"FREEZE_CONTEXT,ALL_JOBS"))
$	WRITE SYS$OUTPUT "THE ENTRY NUMBER OF ", P1, " IS ", ENTRY_NUMBER, "."
$	!DELETE/ENTRY = ENTRY_NUMBER
$	GOTO JLOOP

Which does what you want.
--------------------------------------------------------------------------------
Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL

Disclaimer:  Hey, I understand VAXen and VMS.  That's what I get paid for.  My
understanding of astronomy is purely at the amateur level (or below).  So
unless what I'm saying is directly related to VAX/VMS, don't hold me or my
organization responsible for it.  If it IS related to VAX/VMS, you can try to
hold me responsible for it, but my organization had nothing to do with it.
Newsgroups: comp.os.vms