Reputation: 547
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!
Upvotes: 1
Views: 3716
Reputation: 16928
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
Upvotes: 5