Page 1 of 1

Get the entry number of a batch job

Posted: Thu Oct 22, 2020 11:35 am
by mjimji
Is there a (simple) way of getting the entry number of a batch job from within the job?
Thanks,
Mark

Re: Get the entry number of a batch job

Posted: Thu Oct 22, 2020 2:49 pm
by sms

Code: Select all

> Is there a (simple) way [...]

   Define "simple".

      HELP LEXICALS F$GETQUI   ! (Abandon hope, ...)

its $ submit /noprint qe.com /log = []qe.log
Job qe (queue SYS$BATCH_ITS, entry 963) started on SYS$BATCH_ITS
its $ 

Job qe (queue SYS$BATCH_ITS, entry 963) completed

its $ type qe.log
$ Set NoOn
$ VERIFY = F$VERIFY(F$TRNLNM("SYLOGIN_VERIFY"))
      entry: 963
  SMS          job terminated at 22-OCT-2020 13:39:50.38

  Accounting information:
  Buffered I/O count:                102      Peak working set size:       4672
  Direct I/O count:                   47      Peak virtual size:         178112
  Page faults:                       367      Mounted volumes:                0
  Charged CPU time:        0 00:00:00.03      Elapsed time:       0 00:00:00.10

its $ type qe.com
$!              function         item            object-id   flags
$ e = f$getqui( "DISPLAY_ENTRY", "ENTRY_NUMBER",           , "THIS_JOB")
$!
$ write sys$output "      entry: ''e'"

Re: Get the entry number of a batch job

Posted: Fri Oct 23, 2020 7:52 am
by cct
Yes, f$getqui can be a bit daunting at first!

However there is a much simpler way - look for the local symbol $ENTRY

Code: Select all

$ create test.com
write sys$output "Test"
 ^Z
$ show symb $entry
%DCL-W-UNDSYM, undefined symbol - check validity and spelling
$ subm/keep test
Job TEST (queue SYS$BATCH, entry 1) started on SYS$BATCH
$ show symb $entry
  $ENTRY = "1"
$
Chris

Re: Get the entry number of a batch job

Posted: Fri Oct 23, 2020 1:11 pm
by sms

Code: Select all

> $ show symb $entry
>   $ENTRY = "1"

   Now try that "from within the job".

Re: Get the entry number of a batch job

Posted: Thu Jan 14, 2021 5:23 am
by mjimji
Hi sms,
A much delayed response, but thanks for your answer and I think it qualifies as "simple"!
Regards,
Mark