Get the entry number of a batch job

Post Reply

Topic author
mjimji
Contributor
Posts: 13
Joined: Thu Oct 22, 2020 11:24 am
Reputation: 0
Status: Offline

Get the entry number of a batch job

Post by mjimji » Thu Oct 22, 2020 11:35 am

Is there a (simple) way of getting the entry number of a batch job from within the job?
Thanks,
Mark


sms
Master
Posts: 310
Joined: Fri Aug 21, 2020 5:18 pm
Reputation: 0
Status: Offline

Re: Get the entry number of a batch job

Post by sms » Thu Oct 22, 2020 2:49 pm

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'"

User avatar

cct
Valued Contributor
Posts: 91
Joined: Sat Aug 15, 2020 9:00 am
Reputation: 0
Location: Cambridge, UK
Status: Offline

Re: Get the entry number of a batch job

Post by cct » Fri Oct 23, 2020 7:52 am

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
--
Chris


sms
Master
Posts: 310
Joined: Fri Aug 21, 2020 5:18 pm
Reputation: 0
Status: Offline

Re: Get the entry number of a batch job

Post by sms » Fri Oct 23, 2020 1:11 pm

Code: Select all

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

   Now try that "from within the job".


Topic author
mjimji
Contributor
Posts: 13
Joined: Thu Oct 22, 2020 11:24 am
Reputation: 0
Status: Offline

Re: Get the entry number of a batch job

Post by mjimji » Thu Jan 14, 2021 5:23 am

Hi sms,
A much delayed response, but thanks for your answer and I think it qualifies as "simple"!
Regards,
Mark

Post Reply