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?
How to check the Return Code of each step in a job?
-
- New Member
- Posts: 7
- Joined: Wed Jun 11, 2014 8:33 am
Re: How to check the Return Code of each step in a job?
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?
Why do you need to do this?
Regards
Nic
Nic
-
- New Member
- Posts: 7
- Joined: Wed Jun 11, 2014 8:33 am
Re: How to check the Return Code of each step in a job?
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.
-
- New Member
- Posts: 7
- Joined: Wed Jun 11, 2014 8:33 am
- Anuj Dhawan
- Founder
- Posts: 2824
- Joined: Sun Apr 21, 2013 7:40 pm
- Location: Mumbai, India
- Contact:
Re: How to check the Return Code of each step in a job?
Hi,
I've taken this REXX from another resource and I believe it should help you. Please have a look:
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
Thanks,
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute