HP OpenVMS Systems

ask the wizard
Content starts here

Processing Retained Queue Entries?

» close window

The Question is:

Using the examples in the OpenVMS DCL dictionary, I was able to write a command
procedure to use the F$GETQUI lexical function to report on all batch jobs that
had been retained in the batch queues.  I was able to display the job name,
queue name, entry n umber and owner without any difficulty.  However, I'd also
like to display the actual error that caused the job to abort, as well as the
full filename of the procedure that aborted.  I haven't been able to get either
one to work.
First, I learned that JOB_STATUS does not give you an error status (it just
returns a 128, which I assume just means that the job has been retained on
error). I also know that the error message is displayed if I do a SHOW ENTRY,
but that disrupts the F$GE TQUI context.  Is there any other way of getting the
error status?
As far as the filename is concerned, I've tried using all sorts of variations on
the following:
I inserted this after all of the other necessary "SHOW_JOB" calls (which still
work ok).
However, the return value for this is always blank, plus when I loop back to get
the next job in the current queue context, I get a message stating that it's
lost the context.  I'm guessing that the "FILE_SPECIFICATION" option is only for
print queues, no t batch queues, although that isn't stated in the
documentation.  Is there any way of getting the file spec of the command
procedure that aborted? -Graham

The Answer is :

  Consider using QUI$_CONDITION_VECTOR via the sys$getqui system service,
  or using the item CONDITION_VECTOR via the f$getqui lexical function.
  JOB_STATUS is a bitmask.
  Here is an example of using various f$getqui functions:
$ if f$mode() .nes. "BATCH" then goto not_batch
$ display_job = "display_job"
$ this_job = "this_job"
$ job_name = f$getqui(display_job,"job_name",,this_job)
$ entry_num = f$getqui(display_job,"entry_number",,this_job)
$ queue_name = f$getqui(display_job,"queue_name",,this_job)
$ orig_queue_name = f$getqui(display_job,"restart_queue_name",,this_job)
$ job_priority == f$getqui(display_job,"priority",,this_job)
$ write sys$output -
      f$fao("!/Job !AS (entry !ZL) running on queue !AS on node !AS,",-
$ if orig_queue_name .nes. queue_name then write sys$output -
      f$fao("originally submitted on queue !AS,",orig_queue_name)
$ filename = f$getqui("display_file","file_specification",,this_job)
$ p1 = f$getqui(display_job,"parameter_1",,this_job)
$ p2 = f$getqui(display_job,"parameter_2",,this_job)
$ p3 = f$getqui(display_job,"parameter_3",,this_job)
$ p4 = f$getqui(display_job,"parameter_4",,this_job)
$ p5 = f$getqui(display_job,"parameter_5",,this_job)
$ p6 = f$getqui(display_job,"parameter_6",,this_job)
$ p7 = f$getqui(display_job,"parameter_7",,this_job)
$ p8 = f$getqui(display_job,"parameter_8",,this_job)
$ params = f$edit(p1+p2+p3+p4+p5+p6+p7+p8,"trim") .nes. ""
$ param_ind = f$element(params,"|","no|the following")
$ param_end = f$element(params,"|",".|s:")
$ write sys$output -
     f$fao("using file !AS !#(/)with !AS parameter!AS",-
$ if params then show sym/local p%
  Existing discussions of the f$getqui lexical include the following
  topics: (813), (1240), (2159), (3951), (4546), (4568), (4903), (5188)
  (5471), (5567), (5651), (5793), (5982), (6315), (6877), etc.

answer written or last revised on ( 15-AUG-2001 )

» close window