1

Can anybody give me a hint on how I can get the JOBID of my REXX-Script submitted via a JCL?

JOBNAME, for example, is no problem but I haven't found a reference to the JOBID in any ControlBlock so far.

Thank you very much in advance!

Klaus Schulz
  • 527
  • 1
  • 5
  • 20

1 Answers1

5

Try the following:

/* rexx */
/*                                                                    */
/* Get Jobname and Jobnumber by threading through MVS control blocks  */
/* Note: PSA begins at address zero, address of TCB is at offset 21C  */
/*                                                                    */
TCB = C2D(STORAGE(021C,4))            /* TCB address at '21C'X of PSA */
TIOT = C2D(STORAGE(D2X(TCB + 12), 4))   /* TIOT address at TCB + 12   */
JOBNAME = STORAGE(D2X(TIOT), 8)         /* Jobname at TIOT + 0        */
JSCB = C2D(STORAGE(D2X(TCB  + 180), 4)) /* JSCB address at TCB + 180  */
SSIB = C2D(STORAGE(D2X(JSCB + 316), 4)) /* SSIB address at JSCB + 316 */
JOBNUMBER = STORAGE(D2X(SSIB + 12), 8)  /* Job number at SSIB + 12    */
say 'JobName:' JOBNAME 'JobNumber:' JOBNUMBER
RETURN
NealB
  • 16,670
  • 2
  • 39
  • 60
  • 1
    Thank you very much! Your solution addresses a different Control Block than the solution of Lindy Mayfield (see my link above). I need some time to check if this information is also available in a ASM-program running in an IMS BMP region. That would be great and would save me a lot of time. :-) – Klaus Schulz Feb 20 '14 at 15:50