Operating System - OpenVMS
1753548 Members
5742 Online
108795 Solutions
New Discussion юеВ

f$getqui to return queue entry info

 
SOLVED
Go to solution
Tim Nelson
Honored Contributor

f$getqui to return queue entry info

I know if I read for a couple more hours I would get it..
I am attemping to watch a queued job with a script to watch for when the job ends.

I know I am close.
f$getqui("display_entry","entry_number","somenumber#", ?? )

Basically once the entry is gone or returns null I would like to do some thing afterwards.

Any tips ?

Thanks !!!
3 REPLIES 3
Dale A. Marcy
Trusted Contributor
Solution

Re: f$getqui to return queue entry info

The easiest way is to use the Synchronize command with a /Entry=entry_number. This will cause the command procedure to wait until the entry completes and then continue with the next statement in the procedure. It does require delete access to the specified entry number.
John Gillings
Honored Contributor

Re: f$getqui to return queue entry info

Tim,

By default a batch entry is removed when the job completes. If the entry doesn't exist, your F$GETQUI will return null (which can't be distinguished from using a bogus entry number). If the job is submitted with /RETAIN=ALWAYS (or the queue is set to retain jobs) the entry will remain until explicitly deleted.

F$GETQUI("DISPLAY_ENTRY","JOB_STATUS",entry)

will return the state of the job. For example, a holding job will return 4
(QUI$M_JOB_HOLDING), en executing job will return 2 (QUI$M_JOB_EXECUTING) and a completed job will return 128 (QUI$M_JOB_RETAINED). See the $GETQUI documentation for other possible states. Values (hex) can be found with:

$ PIPE LIBRARY/EXTRACT=$QUIDEF/OUT=SYS$OUTPUT SYS$SHARE:STARLET/MACRO | SEARCH SYS$PIPE QUI$M_JOB_ | SORT SYS$PIPE SYS$OUTPUT

If you want to wait for a specific job to complete, use SYNCHRONIZE as Dale has suggested. Note that SYNCHRONIZE against a retained job will return immediately. Also note that the $STATUS of SYNCHRONIZE will be the completion status of the job, unless the entry number doesn't exist, in which case it will be JBC-E-NOSUCHENT.

Also note that the symbol $ENTRY gets set to the entry number following a PRINT or SUBMIT command. It's much easier to use $ENTRY than search for your job later. For example:

$ SUBMIT/RETAIN=ALWAYS MYBATCHJOB
$ myentry=$entry
$!
$! some stuff...
$!
$ SET NOON
$ SYNCHRONIZE/ENTRY='myentry'
$ mystatus=$STATUS
$ DELETE/ENTRY='myentry'
A crucible of informative mistakes
Tim Nelson
Honored Contributor

Re: f$getqui to return queue entry info

Thanks to all who responded