Page 1 of 1
How to check the Return Code of each step in a job?
Posted: Tue Dec 09, 2014 6:15 pm
by Amit Yadaw
Hi,
As perone fo the requirements, I need to check the RC of each step in a job and write it to a file. It should be done at execution time of the job. (last step of the job).
Can anybody help please?
Re: How to check the Return Code of each step in a job?
Posted: Tue Dec 09, 2014 11:39 pm
by nicc
As far as I am aware this cannot be done without running a second job to analyze the output from the first job. Having said that it may be possible to write an assembler program to go through the control blocks as the last step of the program but I would have to leave that to someone else to confirm/refute.
Why do you need to do this?
Re: How to check the Return Code of each step in a job?
Posted: Wed Dec 10, 2014 9:01 am
by Amit Yadaw
I need to get the step-name where the job might abend. I'll pass this step-name as a parm to a REXX program and rexx program will send an email to a group of people telling about the details where abend happened. Please suggest if there is way of doing it.
Re: How to check the Return Code of each step in a job?
Posted: Wed Dec 10, 2014 9:06 am
by Amit Yadaw
Deleted
Re: How to check the Return Code of each step in a job?
Posted: Wed Dec 10, 2014 9:08 am
by Anuj Dhawan
Hi,
I've taken this REXX from another resource and I believe it should help you. Please have a look:
Code: Select all
/* Rexx */
Address TSO
Numeric digits 64
@tcb = Get_dec_addr(540) /* PSATOLD */
@jscb = Get_dec_addr(@tcb+180) /* TCBJSCB */
step# = Get_stor_contents(@jscb+X2d(E4) 1) /* TCBJSCB */
step# = X2d(C2x(step#))
@jct = Get_dec_addr(@jscb+260) /*JSCBJCT */
@sct = Get_dec_addr(@jct+48 3) /* sct 1st step+16 (JCT prefix*/
/* JCTSDKAD */
last_step = 'NO'
j = 1
If step# = 1 Then
Do
Say 'this is the first step; no rc so far --- '
Exit
End
Else
Do While last_step = 'NO'
sct_abnd = Get_Stor_Contents(@sct+176 1)
sct_cond = Get_Stor_Contents(@sct+188 1)
sct_rc = Get_Stor_Contents(@sct+24 2)
If j < step# Then
Do
dec_Rc = Right(X2d(C2x(sct_rc)),2,'0')
hex_Rc = C2x(sct_rc)
prf = ' '
ltrl = ' Rc(dec): 'dec_Rc ' Rc(hex): 'hex_Rc
End
Else If j = step# Then
Do
dec_Rc = '***'
hex_Rc = '***'
prf = '>'
ltrl = ' *currently executing step* '
End
Else
Do
dec_Rc = 'n/a'
hex_Rc = 'n/a'
prf = ' '
ltrl = ' ***waiting for execution** '
End
stpnam = Get_stor_contents(@sct+68 8)
pgmnam = Get_stor_contents(@sct+124 8)
stpnum = Right(j,3,'0')
lprf = prf'Schtepp 'stpnum' Stepname: 'stpnam ' Pgmname: 'pgmnam
If Bitand(sct_cond,'10'X) = '10'X Then /* COND-Bypass */
ltrl = ' ***bypassed due to cond*** '
If Bitand(sct_abnd,'04'X) = '04'X Then /* Step Abended */
ltrl = ' **** Jobstep abended ***** '
line = lprf''ltrl
Say line
@sct = Get_dec_addr(@sct+36 3) /* sct next step */
If @sct = 0 Then
last_step = 'YES'
j = j + 1
End
Exit
Get_dec_addr:
Parse arg value len
If len = '' Then
len = 4
hex_value = D2x(value)
stor = Storage(hex_value,len)
hex_stor = C2x(stor)
value = X2d(hex_stor)
Return value
/* */
Get_stor_contents:
arg value length
hex_value = D2x(value)
value = Storage(hex_value,length)
Return value