I am not permitted to put PERL
on my production system, and I need to
parse the output from SHOW QUEUE MY$QUEUE /ALL
then search for the line containing my job name "DAILY BACKUP"
and grab the entry number.
I can then do a delete/entry=123
The goal here is to put delete/entry=123 in
a captive menu.
Can this be parsed in DLC? Examples if
possible.
Thanks in advance-
Bill
(w)get http://wwwvms.mppmu.mpg.de/util/com/findjob.com
and http://wwwvms.mppmu.mpg.de/util/com/abojob.com
(the former is also on dcl.openvms.org, but currepted by
my pasying :-()
findjob puts the entry number in a symbol, and you can do
whatever with the entry.
abojob lets You cancel a job by queue/jobname/user .
--
Joseph "Sepp" Huber, Muenchen http://www.huber-joseph.de/
I'd be looking to use F$GETQUI for this.
$ temp = f$getqui ( "" ) ! Clear context
$ temp = f$getqui ( "DISPLAY_QUEUE",, "MY$QUEUE", "WILDCARD" )
$ loop:
$ noaccess = F$GETQUI ( "DISPLAY_JOB", "JOB_INACCESSIBLE",,"ALL_JOBS" )
$ if noaccess .eqs. "" then goto error_exit ! Didn't find matching job
$ if noaccess then goto loop ! No rights to this job
$
$ job_name = F$GETQUI ( "DISPLAY_JOB", "JOB_NAME",,"FREEZE_CONTEXT" )
$ if job_name .nes. "DAILY_BACKUP" then goto loop
$
$ entry_number = F$GETQUI ( "DISPLAY_JOB", "ENTRY_NUMBER",,"FREEZE_CONTEXT" )
$ write sys$output "Entry: ", entry_number
$ temp = f$getqui ( "" ) ! Clear context
$ exit
$
$ error_exit:
$ write sys$output "Failed to find job"
$ temp = f$getqui ( "" ) ! Clear context
$ exit
F$GETQUI is hard to get right. It tends to be picky. I tested the
above and it worked for me. Key points that caught me while debugging
this:
You need the "WILDCARD" flag on the "DISPLAY_QUEUE" call in order to
get F$GETQUI to create the wildcard context so that you can proceed to
look at jobs within the queue. By default, it would have torn down
the context without waiting for a subsequent call.
You need "FREEZE_CONTEXT" on every call after the first one that looks
at a particular job. That keeps you from advancing to the next job in
the queue.
A null string is returned when there are no more jobs (or, in general,
no more of whatever you're looking for).
You can clear the current queue wildcard context by using F$GETQUI("").
This is not always neccessary, but it's a nice touch and a good habit
to get into. I try to clear it at the top of my code as self-defense
and at the bottom to clean things up for the next guy.
$ HELP LEXICAL F$GETQUI Examples is your friend
MAJOR RESTRICTION: (but one that doesn't affect you)
There is only one queue context per process. Every queue-related
command uses it. If you use F$GETQUI in a wildcard loop and you try
to do any queue operations within that loop, you'll destroy the queue
context and make a hash of things.
That means that you can't do $ SHOW QUEUE, $ SHOW ENTRY, $ PRINT,
$ SUBMIT, $ DELETE /ENTRY, $ INIT /QUEUE, $ STOP /QUEUE, etc while
a F$GETQUI wildcard context remains active. (At least not if you
want to keep the context active).
For your application where all you want to do is to discover the
job entry number and then do the queue manipulation later, you're fine.
By the time the user gets around to choosing the menu item for
$ DELETE /ENTRY=123, the F$GETQUI queue context is irrelevant.
John Briggs
Yes, but -- parsing output from SHOW and similar commands is not a
good idea. A future version of OpenVMS could change the output of
the displayed information in a way that would break your code.
It is much beter to use a supported interface -- in this case,
you should be able to use the lexical function F$GETQUI.
--
Charlie Hammond -- Hewlett-Packard Company -- Ft Lauderdale FL USA
(hammond@not@peek.ssr.hp.com -- remove "@not" when replying)
All opinions expressed are my own and not necessarily my employer's.
Instead of parsing the text from SHOW QUEUE, you could
use the f$getqui lexical function to get the entry number.
> I can then do a delete/entry=123
> The goal here is to put delete/entry=123 in
> a captive menu.
>
> Can this be parsed in DLC? Examples if
> possible.
An example:
In your captive menu, there could be an option, say,
"Delete DAILY BACKUP job"
And the code that would be executed would
1. Get the entry #
2. Delete the entry #
It can all be done in DCL.
:...I need to parse the output from SHOW QUEUE MY$QUEUE /ALL
Unsupported, subject to change without notice, potentially likely
to break at unexpected moments, etc.
: then search for the line containing my job name "DAILY BACKUP"
:and grab the entry number.
:
:I can then do a delete/entry=123
:The goal here is to put delete/entry=123 in
:a captive menu.
:
:Can this be parsed in DLC? Examples if possible.
Existing discussions of the f$getqui lexical within the OpenVMS Ask The
Wizard area -- ways to perform the task in a fully-supported,
upward-compatible and entirely documented means -- include the following
topics: (813), (1240), (2159), (3951), (4546), (4568), (4903), (5188),
(5471), (5567), (5651), (5793), (5982), (6315), (6877), (9130), etc.
Probably some others. There are full DCL examples of the f$getqui
lexical posted within these, various of which will likely be of direct
use to you here.
http://www.hp.com/go/openvms/wizard/
---------------------------- #include <rtfaq.h> -----------------------------
For additional, please see the OpenVMS FAQ -- www.hp.com/go/openvms/faq
--------------------------- pure personal opinion ---------------------------
Hoff (Stephen) Hoffman OpenVMS Engineering hoff[at]hp.com