Note that I did try to get the filespec using the DISPLAY_FILE and FILE_SPECIFICATION options, but this seems to not work with
batch jobs, plus it disrupts the queue context. Note that I know I could just do a SHOW QUEUE/BATCH/BY_STATUS=RETAINED to a
file, buit this would also include jobs that aborted during the daytime. And SHOW ENTRY disrupts the queue context as well.
-Graham,
I think you need to "freeze_context". Here's a line from one of my .com's
to get the file name:
$ file = f$getqui( "display_file", -
"file_specification",,"freeze_context,all_jobs") - "]["
Dave
--------------
Dave Greenwood Email: Green...@ORNL.GOV
Oak Ridge National Lab %STD-W-DISCLAIMER, I only speak for myself
So far, so good -- eminently doable.
> I've tried to
> enhance the process to include the actual error message, and the
filespec of the command procedure that aborted, but have been
> unable to get this to work. Is there a way of doing this?
Let's talk about the file spec first. In the general case, you have
to assume that there may be more than one file in the job. Follow
this general structure, which it seems you're already pretty close to:
- Loop over the queues with DISPLAY_QUEUE, using the WILDCARD flag
to make sure you establish a context for the queue's jobs.
- Within the queue loop, loop over the jobs with DISPLAY_JOB. Use the
ALL_JOBS flag to get all jobs in queue (you probably already knew
that). This gives you a context for finding file specs.
- Within the job loop, loop over the files with DISPLAY_FILE. This
should give you each file in the job, in turn.
To get the completion status, use the CONDITION_VECTOR item code with
the DISPLAY_JOB function. If CONDITION_VECTOR returns a null, there's
no completion status to report. Otherwise, it's a hex string, which you
can use like this:
$ hexstring = f$getqui ("display_job", "condition_vector",,
"all_jobs,freeze_context")
$ if hexstring .nes. ""
$ then job_status = %x'hexstring'
$ message = f$message (job_status)
$ endif
There's a possible problem with retrieving the message string. You
might not be working with the same message files as the job. Don't
be too surprised if f$message returns something like %NONAME-F-NOMSG.
> Note that I did try to get the filespec using the DISPLAY_FILE and
FILE_SPECIFICATION options, but this seems to not work with
> batch jobs, plus it disrupts the queue context.
It does indeed work with batch jobs. I suspect either that you haven't
established a context with DISPLAY_JOB, or that you're not using
FREEZE_CONTEXT when you should be. Each successive DISPLAY_QUEUE,
DISPLAY_JOB, or DISPLAY_FILE advances to the next appropriate object,
_unless_ you use the FREEZE_CONTEXT flag. If you use FREEZE_CONTEXT,
that tells f$getqui not to advance to the next object. In other words,
the first DISPLAY_JOB in the job loop doesn't use FREEZE_CONTEXT, but
any other DISPLAY_JOB calls (to get more info on the same job), would
use FREEZE_CONTEXT.
HTH
--
Jim Becker
System Solutions Incorporated (http://www.syssol.com/)
Rockville MD & Herndon VA
DECUS ESILUG (http://eisner.decus.org/lugs/esilug/)
Sent via Deja.com http://www.deja.com/
Before you buy.