We use similar examples of this code to get the return codes of all the steps in a submitted job and pick the baddest one. We use similar things written in COBOL. This is the code for the procedure to obtain the return code only (returns '1' if bad, '0' if good, OKRC is the highest permitted return code). We've used these to write simple job schedulers. Possibly it was this that the OP was lokking for?
GetHighStep:cvt=storage(10,4);ascb=storage(224,4)
ascb_jbni=c2x(storage(d2x(c2d(ascb)+172),4))
ascb_jbns=c2x(storage(d2x(c2d(ascb)+176),4))
assb=storage(d2x(c2d(ascb)+336),4);asxb=Storage(D2x(c2d(ascb)+108),4)
acee=Storage(D2x(c2d(asxb)+200),4);jsab=storage(d2x(c2d(assb)+168),4)
asid=storage(d2x(c2d(ascb)+36),2);psatold=storage(21C,4)
jscb=storage(d2x(c2d(psatold)+180),4);jct=storage(d2x(c2d(jscb)+260),4)
sct=storage(d2x(c2d(jct)+48),3);pnt=0
do forever;if sct=0 then exit 12;pnt=pnt+1
sctansct=storage(d2x(c2d(sct)+36),3)
sctsname.pnt=storage(d2x(c2d(sct)+68),8)
sctpgmnm.pnt=storage(d2x(c2d(sct)+124),8)
sctabcnd.pnt=x2b(c2x(storage(d2x(c2d(sct)+176),1)))
sctstend.pnt=x2b(c2x(storage(d2x(c2d(sct)+188),1)))
if \substr(sctstend.pnt,1,1)then sctsexec.pnt=0
else sctsexec.pnt=c2d(storage(d2x(c2d(sct)+24),2));sct=sctansct
if substr(sctstend.pnt,1,1)&\substr(sctstend.pnt,2,1) then leave;end
OKRC=8;highRC=0;abend=0;step=
do while pnt>1;pnt=pnt-1;if substr(sctabcnd.pnt,6,1) then do
abend=1;step=strip(sctsname.pnt);end
if sctsexec.pnt>highRC&\abend then do;highRC=sctsexec.pnt
step=strip(sctsname.pnt);end;end;
if abend then return="ABEND";else return=HighRC
sysid=storage(d2x(c2d(cvt)+340),4);jobid=storage(d2x(c2d(jsab)+20),8)
user=Storage(d2x(c2d(acee)+21),7)
if ascb_jbns=0 then jobname=storage(ascb_jbni,8)
else jobname=storage(ascb_jbns,8)
if jobname='INIT' then jobname=storage(d2x(c2d(jsab)+28),8)
say 'JOB:'jobname 'USER:'user 'JOBID:'jobid 'Step:'step 'HighRC:'return
if abend|highRC>OKRC then return 1;else return 0
The JCL gets invoked using this JCL:
//MESSAGE EXEC PGM=IKJEFT01,DYNAMNBR=1635,COND=EVEN,
// PARM='ISPSTART CMD(%????????)'
//STEPLIB DD DSN=...............,DISP=SHR
//SYSEXEC DD DSN=............,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY