Discussion:
How to get Return Code for previous Step
(too old to reply)
Lizette Koehler
2014-06-17 13:10:23 UTC
Permalink
I was going to search the archives, until I saw it would not be that easy.



I hope the Listserver gets upgraded for TSO-REXX so it is easier to search.



My question.



I am running a two-step job where I want to capture the info from step one
and use it to create a log file as the second step that will provide the
following



JOBNAME, JOBNUMBER, Return Code, Date and Time



I have seen the snippets in the past where others have done this in REXX.



If some kind soul could send that again, I would be grateful.



Thanks



Lizette




----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Nims,Alva John , Al
2014-06-17 13:30:45 UTC
Permalink
I did a Google search for: rexx return codes previous
And found the following as one of the returned items. (It looks better in the web page) I hope this helps

Date: Thu, 6 Apr 2006 16:25:43 -0400
Reply-To: REXX Programming discussion list <***@LISTSERV.UGA.EDU>
Sender: REXX Programming discussion list <***@LISTSERV.UGA.EDU>
From: Bob Stark <***@PROTECHPTS.COM>
Subject: Re: Rexx Return code in JCL step
In-Reply-To: <OFF2241E41.7EEC363D-ON85257148.006D4AA7-***@dom.com>
Content-Type: text/plain; charset="US-ASCII"
If you use IKJEFT01, it will not propagate the REXX RC back to the step.
IKJEFT1B will do that.
Also, IRXJCL will, e.g.
//JSTEP01 EXEC PGM=IRXJCL,PARM=('RXSETRC 1')
//SYSEXEC DD DISP=SHR,DSN=CPAC.CMDPROC
//*
//* THE FOLLOWING STEP WILL EXIT WITH COND CODE PASSED INTO RXSETRC
//JSTEP02 EXEC PGM=IRXJCL,PARM=('RXSETRC 2')
//SYSEXEC DD DISP=SHR,DSN=CPAC.CMDPROC
-----Original Message-----
From: REXX Programming discussion list [mailto:***@LISTSERV.UGA.EDU] On
Behalf Of ***@DOM.COM
Sent: Thursday, April 06, 2006 3:58 PM
To: ***@LISTSERV.UGA.EDU
Subject: Re: Rexx Return code in JCL step
Suresh,
I just use RETURN cc
The following REXX called STEPCC works for me
/* REXX ***************************************************************/
/* NAME: STEPCC */
/* TYPE: REXX EXEC */
/* FUNCTION: THIS is just for testing. Execute this in batch. */
/* Pass in a condition code number and the step will */
/* end with that condition code! */
/**********************************************************************/
ARG cc
PARSE SOURCE . . execname .
IF cc = '' THEN cc = 0
SAY execname 'Condition Code is being set to' cc
REXXLIST archives -- April 2006 (#4) http://listserv.uga.edu/cgi-bin/wa?A2=ind0604&L=rexxlist&P=374
1 of 4 6/17/2014 9:26 AM
RETURN cc
I run with the following JCL
*************************************************************
* PLACE A NUMBER AFTER STEPCC
* THIS WILL BE THE RETURN CODE OF THE STEP.
* IE: STEPCC 5 WILL CAUSE RC OF 5 IN THIS STEP.
* IF NO NUMBER IS PUT IN, 0 IS ASSUMED
*************************************************************
//STEP1 EXEC PGM=IKJEFT01,REGION=4M,DYNAMNBR=100,TIME=20,
// PARM='STEPCC 5'
//SYSEXEC DD DISP=SHR,DSN=yourdsnwhereSTEPCCresides
//SYSTSIN DD DUMMY,DCB=(RECFM=FB,LRECL=80,BLKSIZE=80)
//SYSTSPRT DD SYSOUT=*
Sal
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Sal Costanzo
~ Dominion Resources Services, Inc.
~ Senior Software Systems Engineer
~ EOC - Systems Programming and Automation
~ Phone: 804-775-5160, Tie Line: 8,736-5160
~ Email: ***@Dom.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Al Nims
Systems Admin/Programmer 3
Information Technology
University of Florida
(352) 273-1298

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-***@vm.marist.edu] On Behalf Of Lizette Koehler
Sent: Tuesday, June 17, 2014 9:10 AM
To: TSO-***@vm.marist.edu
Subject: [TSO-REXX] How to get Return Code for previous Step

I was going to search the archives, until I saw it would not be that easy.



I hope the Listserver gets upgraded for TSO-REXX so it is easier to search.



My question.



I am running a two-step job where I want to capture the info from step one and use it to create a log file as the second step that will provide the following



JOBNAME, JOBNUMBER, Return Code, Date and Time



I have seen the snippets in the past where others have done this in REXX.



If some kind soul could send that again, I would be grateful.



Thanks



Lizette




----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions, send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Lizette Koehler
2014-06-17 13:40:29 UTC
Permalink
Thanks

Lizette


> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On
> Behalf Of Nims,Alva John (Al)
> Sent: Tuesday, June 17, 2014 6:30 AM
> To: TSO-***@VM.MARIST.EDU
> Subject: Re: [TSO-REXX] How to get Return Code for previous Step
>
> I did a Google search for: rexx return codes previous And found the
following as
> one of the returned items. (It looks better in the web page) I hope this
helps
>
> Date: Thu, 6 Apr 2006 16:25:43 -0400
> Reply-To: REXX Programming discussion list
> <***@LISTSERV.UGA.EDU>
> Sender: REXX Programming discussion list <***@LISTSERV.UGA.EDU>
> From: Bob Stark <***@PROTECHPTS.COM>
> Subject: Re: Rexx Return code in JCL step
> In-Reply-To: <OFF2241E41.7EEC363D-ON85257148.006D4AA7-
> ***@dom.com>
> Content-Type: text/plain; charset="US-ASCII"
> If you use IKJEFT01, it will not propagate the REXX RC back to the step.
> IKJEFT1B will do that.
> Also, IRXJCL will, e.g.
> //JSTEP01 EXEC PGM=IRXJCL,PARM=('RXSETRC 1') //SYSEXEC DD
> DISP=SHR,DSN=CPAC.CMDPROC
> //*
> //* THE FOLLOWING STEP WILL EXIT WITH COND CODE PASSED INTO
> RXSETRC
> //JSTEP02 EXEC PGM=IRXJCL,PARM=('RXSETRC 2') //SYSEXEC DD
> DISP=SHR,DSN=CPAC.CMDPROC -----Original Message-----
> From: REXX Programming discussion list
> [mailto:***@LISTSERV.UGA.EDU] On Behalf Of
> ***@DOM.COM
> Sent: Thursday, April 06, 2006 3:58 PM
> To: ***@LISTSERV.UGA.EDU
> Subject: Re: Rexx Return code in JCL step Suresh, I just use RETURN cc The
> following REXX called STEPCC works for me
> /* REXX ***************************************************************/
> /* NAME: STEPCC */
> /* TYPE: REXX EXEC */
> /* FUNCTION: THIS is just for testing. Execute this in batch. */
> /* Pass in a condition code number and the step will */
> /* end with that condition code! */
> /**********************************************************************/
> ARG cc
> PARSE SOURCE . . execname .
> IF cc = '' THEN cc = 0
> SAY execname 'Condition Code is being set to' cc REXXLIST archives --
April 2006
> (#4) http://listserv.uga.edu/cgi-bin/wa?A2=ind0604&L=rexxlist&P=374
> 1 of 4 6/17/2014 9:26 AM
> RETURN cc
> I run with the following JCL
> *************************************************************
> * PLACE A NUMBER AFTER STEPCC
> * THIS WILL BE THE RETURN CODE OF THE STEP.
> * IE: STEPCC 5 WILL CAUSE RC OF 5 IN THIS STEP.
> * IF NO NUMBER IS PUT IN, 0 IS ASSUMED
> *************************************************************
> //STEP1 EXEC PGM=IKJEFT01,REGION=4M,DYNAMNBR=100,TIME=20,
> // PARM='STEPCC 5'
> //SYSEXEC DD DISP=SHR,DSN=yourdsnwhereSTEPCCresides
> //SYSTSIN DD DUMMY,DCB=(RECFM=FB,LRECL=80,BLKSIZE=80)
> //SYSTSPRT DD SYSOUT=*
> Sal
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~ Sal Costanzo
> ~ Dominion Resources Services, Inc.
> ~ Senior Software Systems Engineer
> ~ EOC - Systems Programming and Automation ~ Phone: 804-775-5160, Tie
Line:
> 8,736-5160 ~ Email: ***@Dom.com
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Al Nims
> Systems Admin/Programmer 3
> Information Technology
> University of Florida
> (352) 273-1298
>
> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-***@vm.marist.edu] On Behalf
> Of Lizette Koehler
> Sent: Tuesday, June 17, 2014 9:10 AM
> To: TSO-***@vm.marist.edu
> Subject: [TSO-REXX] How to get Return Code for previous Step
>
> I was going to search the archives, until I saw it would not be that easy.
>
>
>
> I hope the Listserver gets upgraded for TSO-REXX so it is easier to
search.
>
>
>
> My question.
>
>
>
> I am running a two-step job where I want to capture the info from step one
and use it
> to create a log file as the second step that will provide the following
>
>
>
> JOBNAME, JOBNUMBER, Return Code, Date and Time
>
>
>
> I have seen the snippets in the past where others have done this in REXX.
>
>
>
> If some kind soul could send that again, I would be grateful.
>
>
>
> Thanks
>
>
>
> Lizette
>
>
>
>
> ----------------------------------------------------------------------
> For TSO-REXX subscribe / signoff / archive access instructions, send email
to
> ***@VM.MARIST.EDU with the message: INFO TSO-REXX
>
> ----------------------------------------------------------------------
> For TSO-REXX subscribe / signoff / archive access instructions, send email
to
> ***@VM.MARIST.EDU with the message: INFO TSO-REXX

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Nims,Alva John , Al
2014-06-17 13:35:37 UTC
Permalink
I think I found a better one:

This was from the same search, but latter in the list: (the formatting Is atrocious and you may have to do some poking and prodding to get it to work)



Jon S.

Jon S. R.

Senior Systems Analyst at Eagle Data Systems

Add a step at the end of your job, suxh as:

//*--------------------------------------------------------------------*
//* DISPLAY RETURN CODES |
//*--------------------------------------------------------------------*
//GETRC EXEC PGM=IKJEFT01,DYNAMNBR=90,REGION=4M,
// COND=(EVEN),
// PARM=('%GETRC')
//SYSEXEC DD DSN=AT.MS.NLM.USER.REXXLIB,DISP=SHR
//SYSTSIN DD DUMMY
//SYSTSPRT DD SYSOUT=*
//*
Thw rexx program follows.
/* rexx getrc */
/* get the step name and return code */
dump_opt = "N"
parm_opt = "N"
dgts = "0123456789"
parse arg getrc_opt getrc_opts
do while getrc_opt \= ""
getrc_opt = translate(getrc_opt)
if getrc_opt = "PARM" then
parm_opt = "Y"
parse var getrc_opts getrc_opt getrc_opts
end
numeric digits(32) /* ensure max precision */
tcb = storage(d2x(540),4) /* psatold in psa */
jscb = storage(d2x(c2d(tcb)+180),4) /* tcbjscb in tcb */
jct = storage(d2x(c2d(jscb)+261),3) /* jscbjcta in jscb */
this_step_no = x2d(c2x(storage(d2x(c2d(jscb)+228),1)))
/* this step no. */
fsct = storage(d2x(c2d(jct)+48),3) /* jctsdkad in jct */
/* is first sct */
temp_sct = fsct
high_rc = 0
abend = "N"
say " Job Step Proc Step Program Rc"
do i = 1 to this_step_no - 1
jstep = storage(d2x(c2d(temp_sct)+60),8)
pstep = storage(d2x(c2d(temp_sct)+68),8)
pgmname = storage(d2x(c2d(temp_sct)+124),8)
rcstep = x2d(c2x(storage(d2x(c2d(temp_sct)+24),2)))
sctx = storage(d2x(c2d(temp_sct)+84),3)
step_parm = strip(storage(d2x(c2d(sctx)+20),100),"T","00"X)
/* sctsexec in sct */
bypass = storage(d2x(c2d(temp_sct)+188),1)
if x2d(c2x(bypass)) = 80 then /* check if not executed */
rcstep = 'FLUSHED '
else
if x2d(c2x(storage(d2x(c2d(temp_sct)+176),1))) = 4 then do
abend = "Y"
abend_code = x2d(c2x(storage(d2x(c2d(sctx)+130),2)))
if abend_code >= 4096 then do
abend_code = left(c2x(storage(d2x(c2d(sctx)+129),2)),3)
abend_code = " S" || abend_code
end
else
abend_code = "U" || abend_code
if step_parm = "" then
rcstep = "ABEND" || abend_code "PARM =" step_parm
else
rcstep = "ABEND" || abend_code "PARM =" step_parm
end
else
high_rc = max(high_rc,rcstep)
if parm_opt = "Y" then
rcstep = rcstep " " step_parm
select
when jstep = "" & verify(rcstep,dgts) = 0 then
say right(i,3) pstep copies(" ",8) pgmname mask(rcstep,4)
when jstep = "" then
say right(i,3) pstep copies(" ",8) pgmname rcstep
when verify(rcstep,dgts) = 0 then
say right(i,3) jstep pstep pgmname mask(rcstep,4)
otherwise
say right(i,3) jstep pstep pgmname rcstep
end
temp_sct = storage(d2x(c2d(temp_sct)+36),3)
end
if abend = "Y" then
say "highest rc - ABEND" || abend_code
else
say "highest rc =" mask(high_rc,4)
return

Al Nims
Systems Admin/Programmer 3
Information Technology
University of Florida
(352) 273-1298

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-***@vm.marist.edu] On Behalf Of Lizette Koehler
Sent: Tuesday, June 17, 2014 9:10 AM
To: TSO-***@vm.marist.edu
Subject: [TSO-REXX] How to get Return Code for previous Step

I was going to search the archives, until I saw it would not be that easy.



I hope the Listserver gets upgraded for TSO-REXX so it is easier to search.



My question.



I am running a two-step job where I want to capture the info from step one and use it to create a log file as the second step that will provide the following



JOBNAME, JOBNUMBER, Return Code, Date and Time



I have seen the snippets in the past where others have done this in REXX.



If some kind soul could send that again, I would be grateful.



Thanks



Lizette




----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions, send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Lee, Bill
2014-06-17 13:55:13 UTC
Permalink
This routine contains a few references to a function called MASK.

This is not a standard REXX function. Anybody know what it does or has a
copy?


On Tue, Jun 17, 2014 at 9:35 AM, Nims,Alva John (Al) <***@ufl.edu> wrote:

> I think I found a better one:
>
> This was from the same search, but latter in the list: (the formatting Is
> atrocious and you may have to do some poking and prodding to get it to work)
>
>
>
> Jon S.
>
> Jon S. R.
>
> Senior Systems Analyst at Eagle Data Systems
>
> Add a step at the end of your job, suxh as:
>
> //*--------------------------------------------------------------------*
> //* DISPLAY RETURN CODES |
> //*--------------------------------------------------------------------*
> //GETRC EXEC PGM=IKJEFT01,DYNAMNBR=90,REGION=4M,
> // COND=(EVEN),
> // PARM=('%GETRC')
> //SYSEXEC DD DSN=AT.MS.NLM.USER.REXXLIB,DISP=SHR
> //SYSTSIN DD DUMMY
> //SYSTSPRT DD SYSOUT=*
> //*
> Thw rexx program follows.
> /* rexx getrc */
> /* get the step name and return code */
> dump_opt = "N"
> parm_opt = "N"
> dgts = "0123456789"
> parse arg getrc_opt getrc_opts
> do while getrc_opt \= ""
> getrc_opt = translate(getrc_opt)
> if getrc_opt = "PARM" then
> parm_opt = "Y"
> parse var getrc_opts getrc_opt getrc_opts
> end
> numeric digits(32) /* ensure max precision */
> tcb = storage(d2x(540),4) /* psatold in psa */
> jscb = storage(d2x(c2d(tcb)+180),4) /* tcbjscb in tcb */
> jct = storage(d2x(c2d(jscb)+261),3) /* jscbjcta in jscb */
> this_step_no = x2d(c2x(storage(d2x(c2d(jscb)+228),1)))
> /* this step no. */
> fsct = storage(d2x(c2d(jct)+48),3) /* jctsdkad in jct */
> /* is first sct */
> temp_sct = fsct
> high_rc = 0
> abend = "N"
> say " Job Step Proc Step Program Rc"
> do i = 1 to this_step_no - 1
> jstep = storage(d2x(c2d(temp_sct)+60),8)
> pstep = storage(d2x(c2d(temp_sct)+68),8)
> pgmname = storage(d2x(c2d(temp_sct)+124),8)
> rcstep = x2d(c2x(storage(d2x(c2d(temp_sct)+24),2)))
> sctx = storage(d2x(c2d(temp_sct)+84),3)
> step_parm = strip(storage(d2x(c2d(sctx)+20),100),"T","00"X)
> /* sctsexec in sct */
> bypass = storage(d2x(c2d(temp_sct)+188),1)
> if x2d(c2x(bypass)) = 80 then /* check if not executed */
> rcstep = 'FLUSHED '
> else
> if x2d(c2x(storage(d2x(c2d(temp_sct)+176),1))) = 4 then do
> abend = "Y"
> abend_code = x2d(c2x(storage(d2x(c2d(sctx)+130),2)))
> if abend_code >= 4096 then do
> abend_code = left(c2x(storage(d2x(c2d(sctx)+129),2)),3)
> abend_code = " S" || abend_code
> end
> else
> abend_code = "U" || abend_code
> if step_parm = "" then
> rcstep = "ABEND" || abend_code "PARM =" step_parm
> else
> rcstep = "ABEND" || abend_code "PARM =" step_parm
> end
> else
> high_rc = max(high_rc,rcstep)
> if parm_opt = "Y" then
> rcstep = rcstep " " step_parm
> select
> when jstep = "" & verify(rcstep,dgts) = 0 then
> say right(i,3) pstep copies(" ",8) pgmname mask(rcstep,4)
> when jstep = "" then
> say right(i,3) pstep copies(" ",8) pgmname rcstep
> when verify(rcstep,dgts) = 0 then
> say right(i,3) jstep pstep pgmname mask(rcstep,4)
> otherwise
> say right(i,3) jstep pstep pgmname rcstep
> end
> temp_sct = storage(d2x(c2d(temp_sct)+36),3)
> end
> if abend = "Y" then
> say "highest rc - ABEND" || abend_code
> else
> say "highest rc =" mask(high_rc,4)
> return
>
> Al Nims
> Systems Admin/Programmer 3
> Information Technology
> University of Florida
> (352) 273-1298
>
> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-***@vm.marist.edu] On Behalf
> Of Lizette Koehler
> Sent: Tuesday, June 17, 2014 9:10 AM
> To: TSO-***@vm.marist.edu
> Subject: [TSO-REXX] How to get Return Code for previous Step
>
> I was going to search the archives, until I saw it would not be that easy.
>
>
>
> I hope the Listserver gets upgraded for TSO-REXX so it is easier to search.
>
>
>
> My question.
>
>
>
> I am running a two-step job where I want to capture the info from step one
> and use it to create a log file as the second step that will provide the
> following
>
>
>
> JOBNAME, JOBNUMBER, Return Code, Date and Time
>
>
>
> I have seen the snippets in the past where others have done this in REXX.
>
>
>
> If some kind soul could send that again, I would be grateful.
>
>
>
> Thanks
>
>
>
> Lizette
>
>
>
>
> ----------------------------------------------------------------------
> For TSO-REXX subscribe / signoff / archive access instructions, send email
> to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
>
> ----------------------------------------------------------------------
> For TSO-REXX subscribe / signoff / archive access instructions,
> send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
>

--
--------------------------------------------------
This e-mail transmission contains information intended only for the use of
the recipient(s) named above. Further, it contains information that may be
privileged and confidential. If you are not the intended recipient, you
are hereby notified that any dissemination, distribution, or copying of
this message (including any attachments) is strictly prohibited. If you
have received this e-mail in error, please notify the sender by reply
e-mail and then delete this message from your mail system. Thank you for
your compliance

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Christian Birr
2014-06-17 14:23:13 UTC
Permalink
Would it be that mask does something like RIGHT(RC,4,"0") ?

Christian

-----Ursprüngliche Nachricht-----
Von: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] Im Auftrag von Lee, Bill
Gesendet: Dienstag, 17. Juni 2014 15:55
An: TSO-***@VM.MARIST.EDU
Betreff: Re: [TSO-REXX] How to get Return Code for previous Step

This routine contains a few references to a function called MASK.

This is not a standard REXX function. Anybody know what it does or has a
copy?


On Tue, Jun 17, 2014 at 9:35 AM, Nims,Alva John (Al) <***@ufl.edu> wrote:

> I think I found a better one:
>
> This was from the same search, but latter in the list: (the formatting Is
> atrocious and you may have to do some poking and prodding to get it to work)
>
>
>
> Jon S.
>
> Jon S. R.
>
> Senior Systems Analyst at Eagle Data Systems
>
> Add a step at the end of your job, suxh as:
>
> //*--------------------------------------------------------------------*
> //* DISPLAY RETURN CODES |
> //*--------------------------------------------------------------------*
> //GETRC EXEC PGM=IKJEFT01,DYNAMNBR=90,REGION=4M,
> // COND=(EVEN),
> // PARM=('%GETRC')
> //SYSEXEC DD DSN=AT.MS.NLM.USER.REXXLIB,DISP=SHR
> //SYSTSIN DD DUMMY
> //SYSTSPRT DD SYSOUT=*
> //*
> Thw rexx program follows.
> /* rexx getrc */
> /* get the step name and return code */
> dump_opt = "N"
> parm_opt = "N"
> dgts = "0123456789"
> parse arg getrc_opt getrc_opts
> do while getrc_opt \= ""
> getrc_opt = translate(getrc_opt)
> if getrc_opt = "PARM" then
> parm_opt = "Y"
> parse var getrc_opts getrc_opt getrc_opts
> end
> numeric digits(32) /* ensure max precision */
> tcb = storage(d2x(540),4) /* psatold in psa */
> jscb = storage(d2x(c2d(tcb)+180),4) /* tcbjscb in tcb */
> jct = storage(d2x(c2d(jscb)+261),3) /* jscbjcta in jscb */
> this_step_no = x2d(c2x(storage(d2x(c2d(jscb)+228),1)))
> /* this step no. */
> fsct = storage(d2x(c2d(jct)+48),3) /* jctsdkad in jct */
> /* is first sct */
> temp_sct = fsct
> high_rc = 0
> abend = "N"
> say " Job Step Proc Step Program Rc"
> do i = 1 to this_step_no - 1
> jstep = storage(d2x(c2d(temp_sct)+60),8)
> pstep = storage(d2x(c2d(temp_sct)+68),8)
> pgmname = storage(d2x(c2d(temp_sct)+124),8)
> rcstep = x2d(c2x(storage(d2x(c2d(temp_sct)+24),2)))
> sctx = storage(d2x(c2d(temp_sct)+84),3)
> step_parm = strip(storage(d2x(c2d(sctx)+20),100),"T","00"X)
> /* sctsexec in sct */
> bypass = storage(d2x(c2d(temp_sct)+188),1)
> if x2d(c2x(bypass)) = 80 then /* check if not executed */
> rcstep = 'FLUSHED '
> else
> if x2d(c2x(storage(d2x(c2d(temp_sct)+176),1))) = 4 then do
> abend = "Y"
> abend_code = x2d(c2x(storage(d2x(c2d(sctx)+130),2)))
> if abend_code >= 4096 then do
> abend_code = left(c2x(storage(d2x(c2d(sctx)+129),2)),3)
> abend_code = " S" || abend_code
> end
> else
> abend_code = "U" || abend_code
> if step_parm = "" then
> rcstep = "ABEND" || abend_code "PARM =" step_parm
> else
> rcstep = "ABEND" || abend_code "PARM =" step_parm
> end
> else
> high_rc = max(high_rc,rcstep)
> if parm_opt = "Y" then
> rcstep = rcstep " " step_parm
> select
> when jstep = "" & verify(rcstep,dgts) = 0 then
> say right(i,3) pstep copies(" ",8) pgmname mask(rcstep,4)
> when jstep = "" then
> say right(i,3) pstep copies(" ",8) pgmname rcstep
> when verify(rcstep,dgts) = 0 then
> say right(i,3) jstep pstep pgmname mask(rcstep,4)
> otherwise
> say right(i,3) jstep pstep pgmname rcstep
> end
> temp_sct = storage(d2x(c2d(temp_sct)+36),3)
> end
> if abend = "Y" then
> say "highest rc - ABEND" || abend_code
> else
> say "highest rc =" mask(high_rc,4)
> return
>
> Al Nims
> Systems Admin/Programmer 3
> Information Technology
> University of Florida
> (352) 273-1298
>
> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-***@vm.marist.edu] On Behalf
> Of Lizette Koehler
> Sent: Tuesday, June 17, 2014 9:10 AM
> To: TSO-***@vm.marist.edu
> Subject: [TSO-REXX] How to get Return Code for previous Step
>
> I was going to search the archives, until I saw it would not be that easy.
>
>
>
> I hope the Listserver gets upgraded for TSO-REXX so it is easier to search.
>
>
>
> My question.
>
>
>
> I am running a two-step job where I want to capture the info from step one
> and use it to create a log file as the second step that will provide the
> following
>
>
>
> JOBNAME, JOBNUMBER, Return Code, Date and Time
>
>
>
> I have seen the snippets in the past where others have done this in REXX.
>
>
>
> If some kind soul could send that again, I would be grateful.
>
>
>
> Thanks
>
>
>
> Lizette
>
>
>
>
> ----------------------------------------------------------------------
> For TSO-REXX subscribe / signoff / archive access instructions, send email
> to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
>
> ----------------------------------------------------------------------
> For TSO-REXX subscribe / signoff / archive access instructions,
> send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
>

--
--------------------------------------------------
This e-mail transmission contains information intended only for the use of
the recipient(s) named above. Further, it contains information that may be
privileged and confidential. If you are not the intended recipient, you
are hereby notified that any dissemination, distribution, or copying of
this message (including any attachments) is strictly prohibited. If you
have received this e-mail in error, please notify the sender by reply
e-mail and then delete this message from your mail system. Thank you for
your compliance

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Iain Robertson
2014-06-17 14:38:01 UTC
Permalink
You could always interrogate SDSF
This will just write out Jobname, job Number, Stepname Return Code, Date & Time when run via IKJEFT01 as a final step.

/* REXX */
/* change dsnames to something appropriate */
SDSFInp = 'CLIDR01.SDSFINP'
SDSFlst = 'CLIDR01.SDSFLST'
retcode = 0

/* get jobname */
cvt_addr = c2d(storage(21c,4))
tiot_base = c2d(storage(d2x(cvt_addr + 12),4))
tiot_addr = tiot_base + 24
j_s_p = storage(d2x(tiot_base),24)
parse var j_s_p 1 jobname 9 stepname 17 procname

/* call SDSF to get details of completed steps */
Call SDSFCALL
found = 0
finished = 0
ix = 1
do until finished
parse var SDSFLog.ix a b zz .
if zz = '-JOBNAME' then do
found = 1
finished = 1
end
else do
ix = ix + 1
if ix > SDSFLog.0 then finished = 1
end
end
if found = 0 then do
say 'error'
return(8)
end
else do
ix = ix+1
say 'Jobname JobNumber StepName RC Date Time'
Jdate=DATE('N')
do until pos('*****',SDSFLog.ix) > 0
parse var SDSFLog.ix Jtime Jnum Jname Sname Rcode .
Jname = substr(Jname,2)
Jnum = left(substr(Jnum,4),9)
Sname=left(Sname,8)
Jname=left(Jname,8)
Rcode=left(Rcode,5)
Jdate=DATE('N')
say Jname Jnum Sname Rcode Jdate Jtime
ix = ix+1
end
end
return(retcode)

SDSFCALL:
NEWSTACK
QUEUE "PREFIX" JobName
QUEUE "DA"
QUEUE "FIND" JobName
QUEUE "++?"
QUEUE "FIND JESMSGLG"
QUEUE "++S"
Call RunSDSF
If sdsfcode ¬= 0 Then
Do
Say '*** SDSF call to read output for' JobName 'failed' sdsfcode
"Free Fi(ISFIN)"
"Free Fi(ISFOUT)"
DELSTACK
Exit 0
End
Else Nop
DELSTACK
RETURN

RunSDSF:
SDSFLog. = ''
dummy=msg("OFF")
"delete '"||SDSFInp||"'"
"delete '"||SDSFlst||"'"
dummy=msg("ON")
"alloc fi(ISFIN) ds('"SDSFInp"') new space(1 1) track ",
"lrecl(80) dsorg(ps) recfm(f b) reuse"
"alloc fi(ISFOUT) ds('"SDSFLst"') new space(10 10) cylinder ",
"lrecl(160) dsorg(ps) recfm(f b) reuse"
"EXECIO * DISKW ISFIN (FINIS"
address linkmvs 'SDSF'
sdsfcode = rc
"EXECIO * DISKR ISFOUT (STEM SDSFLog. FINIS"
"Free Fi(ISFIN)"
"Free Fi(ISFOUT)"
Return


Iain Robertson
BT TSO Senior DBA


> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On
> Behalf Of Lizette Koehler
> Sent: 17 June 2014 14:10
> To: TSO-***@VM.MARIST.EDU
> Subject: [TSO-REXX] How to get Return Code for previous Step
>
> I was going to search the archives, until I saw it would not be that easy.
>
>
>
> I hope the Listserver gets upgraded for TSO-REXX so it is easier to search.
>
>
>
> My question.
>
>
>
> I am running a two-step job where I want to capture the info from step one and use it
> to create a log file as the second step that will provide the following
>
>
>
> JOBNAME, JOBNUMBER, Return Code, Date and Time
>
>
>
> I have seen the snippets in the past where others have done this in REXX.
>
>
>
> If some kind soul could send that again, I would be grateful.
>
>
>
> Thanks
>
>
>
> Lizette
>
>
>
>
> ----------------------------------------------------------------------
> For TSO-REXX subscribe / signoff / archive access instructions, send email to
> ***@VM.MARIST.EDU with the message: INFO TSO-REXX

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Robert Zenuk
2014-06-17 18:06:24 UTC
Permalink
Here is a program called RCSTEP. It takes the desired STEPNAME as a parm and returns the current jobname, jobnumber, stepname and stepRC. It pulls the IEF142I message from JESYSMSG using SDSF/REXX.

/*********************************************************************/
/* REXX */
/*********************************************************************/
/* Purpose: Retrieve the return code from a specific step */
/*-------------------------------------------------------------------*/
/* Syntax: RCSTEP stepname */
/*-------------------------------------------------------------------*/
/* Parms: STEPNAME - Step name to get RC */
/* */
/*********************************************************************/
/* Change Log */
/* */
/* Author Date Reason */
/* -------- --------- ----------------------------------------- */
/* R. Zenuk Jun 2014 Initial Creation */
/* */
/*********************************************************************/
/* Accept stepname */
/*********************************************************************/
arg stepname .
/*********************************************************************/
/* Set Exit Code, the number of bad steps and the current jobname */
/*********************************************************************/
EXITRC = 0
jobname = mvsvar('SYMDEF','JOBNAME')
/*********************************************************************/
/* Invoke SDSF DA */
/*********************************************************************/
if isfcalls('ON') <> 0 then exit 99
address SDSF "ISFEXEC DA"
call isferror 'ISFEXEC'
/*********************************************************************/
/* Find the current jobname */
/*********************************************************************/
do i=1 to isfrows
if jname.i = jobname then
do
jobnum = jobid.i
/*********************************************************************/
/* Select the jobname and allocate all the output sysout datasets */
/*********************************************************************/
address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
call isferror 'ISFACT'
/*********************************************************************/
/* Read the JESYSMSG output */
/*********************************************************************/
address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
/*********************************************************************/
/* Parse out the STEP and RC */
/*********************************************************************/
do l=1 to jobmsgs.0
parse var jobmsgs.l msgid . step . . . . . . . steprc .
if msgid <> 'IEF142I' then
iterate
else
if step = stepname then
leave
end
end
end
/*********************************************************************/
/* Summarize the bad steps */
/*********************************************************************/
say
say jobname jobnum stepname 'RC='steprc
say
call isfcalls 'OFF'
exit EXITRC
/*********************************************************************/
/* SDSF error conditions */
/*********************************************************************/
isferror: arg sdfscall
select
/*********************************************************************/
/* Ignorable conditions */
/*********************************************************************/
when isfmsg = '' then return
when isfmsg = 'DATA SET ALLOCATED' then return
/*********************************************************************/
/* Real errors - always RC=16 */
/*********************************************************************/
otherwise
do
say isfmsg
say
do e=1 to isfmsg2.0
say sdsfcall right(e,2)':' isfmsg2.e
end
exit 16
end
end

Some test JCL:

//jobcard
//***************************************************************
//* SDSF/REXX TO ISSUE COMMANDS IN BATCH *
//***************************************************************
//STEP1 EXEC PGM=IKJEFT01,PARM='SETRC 5'
//SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
//STEP2 EXEC PGM=IEFBR14
//STEP3 EXEC PGM=IEFBR14
//STEP4 EXEC PGM=IEFBR14
//STEP5 EXEC PGM=IKJEFT01,PARM='SETRC 88'
//SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
//STEP6 EXEC PGM=IEFBR14
//STEP7 EXEC PGM=IEFBR14
//STEP8 EXEC PGM=IEFBR14
//STEP9 EXEC PGM=IEFBR14
//RCSTEP EXEC PGM=IKJEFT01,PARM='RCSTEP STEP5'
//SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
//STEP10 EXEC PGM=IEFBR14

The SETRC EXEC is as follows

/* rexx */
exit arg(1)


Rob

-----Original Message-----
From: Lizette Koehler <***@MINDSPRING.COM>
To: TSO-REXX <TSO-***@VM.MARIST.EDU>
Sent: Tue, Jun 17, 2014 6:10 am
Subject: How to get Return Code for previous Step


I was going to search the archives, until I saw it would not be that easy.

I hope the Listserver gets upgraded for TSO-REXX so it is easier to search.

My question.

I am running a two-step job where I want to capture the info from step one
nd use it to create a log file as the second step that will provide the
ollowing

JOBNAME, JOBNUMBER, Return Code, Date and Time

I have seen the snippets in the past where others have done this in REXX.

If some kind soul could send that again, I would be grateful.

Thanks

Lizette


---------------------------------------------------------------------
or TSO-REXX subscribe / signoff / archive access instructions,
end email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX


----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Robert Zenuk
2014-06-18 00:54:48 UTC
Permalink
An update. Some streamlining and I noticed Lizette wanted the step date and time also...

/*********************************************************************/
/* REXX */
/*********************************************************************/
/* Purpose: Retrieve the return code from a specific step */
/*-------------------------------------------------------------------*/
/* Syntax: RCSTEP stepname */
/*-------------------------------------------------------------------*/
/* Parms: STEPNAME - Step name to get RC */
/* */
/*********************************************************************/
/* Change Log */
/* */
/* Author Date Reason */
/* -------- --------- ----------------------------------------- */
/* R. Zenuk Jun 2014 Initial Creation */
/* */
/*********************************************************************/
/* Accept stepname */
/*********************************************************************/
arg stepname .
EXITRC = 0
jobname = mvsvar('SYMDEF','JOBNAME')
/*********************************************************************/
/* Invoke SDSF DA */
/*********************************************************************/
if isfcalls('ON') <> 0 then exit 99
address SDSF "ISFEXEC DA"
/*********************************************************************/
/* Find the current jobname */
/*********************************************************************/
do i=1 to isfrows
if jname.i = jobname then
do
jobnum = jobid.i
/*********************************************************************/
/* Select the jobname and allocate all the output sysout datasets */
/*********************************************************************/
address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
/*********************************************************************/
/* Read the JESYSMSG output */
/*********************************************************************/
address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
/*********************************************************************/
/* Parse out the STEP and RC (IEF142I) */
/*********************************************************************/
do l=1 to jobmsgs.0
parse var jobmsgs.l msgid . step . . . . . . . steprc .
if msgid <> 'IEF142I' then
do
iterate
end
else
if step = stepname then
do
steprc = strip(steprc,'L',0)
/*********************************************************************/
/* Back up and grab the begin (IEF373I) and end time (IEF032I) */
/*********************************************************************/
b = l - 8
parse var jobmsgs.b . . . bdate '.' btime .
bdate = left(bdate,4)'.'right(bdate,3)
btime = left(btime,2)':'right(btime,2)
e = l - 7
parse var jobmsgs.e . . . edate '.' etime .
edate = left(strip(edate),4)'.'right(edate,3)
etime = left(etime,2)':'right(etime,2)
leave i
end
end
leave i
end
end
/*********************************************************************/
/* Print step details */
/*********************************************************************/
say jobname jobnum stepname 'RC='steprc bdate btime '-' edate etime
exit EXITRC

Rob


-----Original Message-----
From: robzenuk <***@aol.com>
To: TSO-REXX <TSO-***@VM.MARIST.EDU>
Sent: Tue, Jun 17, 2014 11:06 am
Subject: Re: How to get Return Code for previous Step


Here is a program called RCSTEP. It takes the desired STEPNAME as a parm and returns the current jobname, jobnumber, stepname and stepRC. It pulls the IEF142I message from JESYSMSG using SDSF/REXX.

/*********************************************************************/
/* REXX */
/*********************************************************************/
/* Purpose: Retrieve the return code from a specific step */
/*-------------------------------------------------------------------*/
/* Syntax: RCSTEP stepname */
/*-------------------------------------------------------------------*/
/* Parms: STEPNAME - Step name to get RC */
/* */
/*********************************************************************/
/* Change Log */
/* */
/* Author Date Reason */
/* -------- --------- ----------------------------------------- */
/* R. Zenuk Jun 2014 Initial Creation */
/* */
/*********************************************************************/
/* Accept stepname */
/*********************************************************************/
arg stepname .
/*********************************************************************/
/* Set Exit Code, the number of bad steps and the current jobname */
/*********************************************************************/
EXITRC = 0
jobname = mvsvar('SYMDEF','JOBNAME')
/*********************************************************************/
/* Invoke SDSF DA */
/*********************************************************************/
if isfcalls('ON') <> 0 then exit 99
address SDSF "ISFEXEC DA"
call isferror 'ISFEXEC'
/*********************************************************************/
/* Find the current jobname */
/*********************************************************************/
do i=1 to isfrows
if jname.i = jobname then
do
jobnum = jobid.i
/*********************************************************************/
/* Select the jobname and allocate all the output sysout datasets */
/*********************************************************************/
address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
call isferror 'ISFACT'
/*********************************************************************/
/* Read the JESYSMSG output */
/*********************************************************************/
address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
/*********************************************************************/
/* Parse out the STEP and RC */
/*********************************************************************/
do l=1 to jobmsgs.0
parse var jobmsgs.l msgid . step . . . . . . . steprc .
if msgid <> 'IEF142I' then
iterate
else
if step = stepname then
leave
end
end
end
/*********************************************************************/
/* Summarize the bad steps */
/*********************************************************************/
say
say jobname jobnum stepname 'RC='steprc
say
call isfcalls 'OFF'
exit EXITRC
/*********************************************************************/
/* SDSF error conditions */
/*********************************************************************/
isferror: arg sdfscall
select
/*********************************************************************/
/* Ignorable conditions */
/*********************************************************************/
when isfmsg = '' then return
when isfmsg = 'DATA SET ALLOCATED' then return
/*********************************************************************/
/* Real errors - always RC=16 */
/*********************************************************************/
otherwise
do
say isfmsg
say
do e=1 to isfmsg2.0
say sdsfcall right(e,2)':' isfmsg2.e
end
exit 16
end
end

Some test JCL:

//jobcard
//***************************************************************
//* SDSF/REXX TO ISSUE COMMANDS IN BATCH *
//***************************************************************
//STEP1 EXEC PGM=IKJEFT01,PARM='SETRC 5'
//SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
//STEP2 EXEC PGM=IEFBR14
//STEP3 EXEC PGM=IEFBR14
//STEP4 EXEC PGM=IEFBR14
//STEP5 EXEC PGM=IKJEFT01,PARM='SETRC 88'
//SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
//STEP6 EXEC PGM=IEFBR14
//STEP7 EXEC PGM=IEFBR14
//STEP8 EXEC PGM=IEFBR14
//STEP9 EXEC PGM=IEFBR14
//RCSTEP EXEC PGM=IKJEFT01,PARM='RCSTEP STEP5'
//SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
//STEP10 EXEC PGM=IEFBR14

The SETRC EXEC is as follows

/* rexx */
exit arg(1)


Rob

-----Original Message-----
From: Lizette Koehler <***@MINDSPRING.COM>
To: TSO-REXX <TSO-***@VM.MARIST.EDU>
Sent: Tue, Jun 17, 2014 6:10 am
Subject: How to get Return Code for previous Step


I was going to search the archives, until I saw it would not be that easy.

I hope the Listserver gets upgraded for TSO-REXX so it is easier to search.

My question.

I am running a two-step job where I want to capture the info from step one
nd use it to create a log file as the second step that will provide the
ollowing

JOBNAME, JOBNUMBER, Return Code, Date and Time

I have seen the snippets in the past where others have done this in REXX.

If some kind soul could send that again, I would be grateful.

Thanks

Lizette


---------------------------------------------------------------------
or TSO-REXX subscribe / signoff / archive access instructions,
end email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX



----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Lizette Koehler
2014-06-18 12:35:03 UTC
Permalink
Thanks everyone.

All of these examples are going into my code folder for future reference.

And thanks Robert for the extra efforts on my behalf.

Lizette


> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On
> Behalf Of Robert Zenuk
> Sent: Tuesday, June 17, 2014 5:54 PM
> To: TSO-***@VM.MARIST.EDU
> Subject: Re: [TSO-REXX] How to get Return Code for previous Step
>
> An update. Some streamlining and I noticed Lizette wanted the step date
and time
> also...
>
> /*********************************************************************/
> /* REXX */
> /*********************************************************************/
> /* Purpose: Retrieve the return code from a specific step */
> /*-------------------------------------------------------------------*/
> /* Syntax: RCSTEP stepname */
> /*-------------------------------------------------------------------*/
> /* Parms: STEPNAME - Step name to get RC */
> /* */
> /*********************************************************************/
> /* Change Log */
> /* */
> /* Author Date Reason */
> /* -------- --------- ----------------------------------------- */
> /* R. Zenuk Jun 2014 Initial Creation */
> /* */
> /*********************************************************************/
> /* Accept stepname */
> /*********************************************************************/
> arg stepname .
> EXITRC = 0
> jobname = mvsvar('SYMDEF','JOBNAME')
> /*********************************************************************/
> /* Invoke SDSF DA */
> /*********************************************************************/
> if isfcalls('ON') <> 0 then exit 99
> address SDSF "ISFEXEC DA"
> /*********************************************************************/
> /* Find the current jobname */
> /*********************************************************************/
> do i=1 to isfrows
> if jname.i = jobname then
> do
> jobnum = jobid.i
> /*********************************************************************/
> /* Select the jobname and allocate all the output sysout datasets */
> /*********************************************************************/
> address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
> /*********************************************************************/
> /* Read the JESYSMSG output */
> /*********************************************************************/
> address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
> /*********************************************************************/
> /* Parse out the STEP and RC (IEF142I) */
> /*********************************************************************/
> do l=1 to jobmsgs.0
> parse var jobmsgs.l msgid . step . . . . . . . steprc .
> if msgid <> 'IEF142I' then
> do
> iterate
> end
> else
> if step = stepname then
> do
> steprc = strip(steprc,'L',0)
> /*********************************************************************/
> /* Back up and grab the begin (IEF373I) and end time (IEF032I) */
> /*********************************************************************/
> b = l - 8
> parse var jobmsgs.b . . . bdate '.' btime .
> bdate = left(bdate,4)'.'right(bdate,3)
> btime = left(btime,2)':'right(btime,2)
> e = l - 7
> parse var jobmsgs.e . . . edate '.' etime .
> edate = left(strip(edate),4)'.'right(edate,3)
> etime = left(etime,2)':'right(etime,2)
> leave i
> end
> end
> leave i
> end
> end
> /*********************************************************************/
> /* Print step details */
> /*********************************************************************/
> say jobname jobnum stepname 'RC='steprc bdate btime '-' edate etime exit
> EXITRC
>
> Rob
>
>
> -----Original Message-----
> From: robzenuk <***@aol.com>
> To: TSO-REXX <TSO-***@VM.MARIST.EDU>
> Sent: Tue, Jun 17, 2014 11:06 am
> Subject: Re: How to get Return Code for previous Step
>
>
> Here is a program called RCSTEP. It takes the desired STEPNAME as a parm
and
> returns the current jobname, jobnumber, stepname and stepRC. It pulls the
IEF142I
> message from JESYSMSG using SDSF/REXX.
>
> /*********************************************************************/
> /* REXX */
> /*********************************************************************/
> /* Purpose: Retrieve the return code from a specific step */
> /*-------------------------------------------------------------------*/
> /* Syntax: RCSTEP stepname */
> /*-------------------------------------------------------------------*/
> /* Parms: STEPNAME - Step name to get RC */
> /* */
> /*********************************************************************/
> /* Change Log */
> /* */
> /* Author Date Reason */
> /* -------- --------- ----------------------------------------- */
> /* R. Zenuk Jun 2014 Initial Creation */
> /* */
> /*********************************************************************/
> /* Accept stepname */
> /*********************************************************************/
> arg stepname .
> /*********************************************************************/
> /* Set Exit Code, the number of bad steps and the current jobname */
> /*********************************************************************/
> EXITRC = 0
> jobname = mvsvar('SYMDEF','JOBNAME')
> /*********************************************************************/
> /* Invoke SDSF DA */
> /*********************************************************************/
> if isfcalls('ON') <> 0 then exit 99
> address SDSF "ISFEXEC DA"
> call isferror 'ISFEXEC'
> /*********************************************************************/
> /* Find the current jobname */
> /*********************************************************************/
> do i=1 to isfrows
> if jname.i = jobname then
> do
> jobnum = jobid.i
> /*********************************************************************/
> /* Select the jobname and allocate all the output sysout datasets */
> /*********************************************************************/
> address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
> call isferror 'ISFACT'
> /*********************************************************************/
> /* Read the JESYSMSG output */
> /*********************************************************************/
> address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
> /*********************************************************************/
> /* Parse out the STEP and RC */
> /*********************************************************************/
> do l=1 to jobmsgs.0
> parse var jobmsgs.l msgid . step . . . . . . . steprc .
> if msgid <> 'IEF142I' then
> iterate
> else
> if step = stepname then
> leave
> end
> end
> end
> /*********************************************************************/
> /* Summarize the bad steps */
> /*********************************************************************/
> say
> say jobname jobnum stepname 'RC='steprc say call isfcalls 'OFF'
> exit EXITRC
> /*********************************************************************/
> /* SDSF error conditions */
> /*********************************************************************/
> isferror: arg sdfscall
> select
> /*********************************************************************/
> /* Ignorable conditions */
> /*********************************************************************/
> when isfmsg = '' then return
> when isfmsg = 'DATA SET ALLOCATED' then return
> /*********************************************************************/
> /* Real errors - always RC=16 */
> /*********************************************************************/
> otherwise
> do
> say isfmsg
> say
> do e=1 to isfmsg2.0
> say sdsfcall right(e,2)':' isfmsg2.e
> end
> exit 16
> end
> end
>
> Some test JCL:
>
> //jobcard
> //***************************************************************
> //* SDSF/REXX TO ISSUE COMMANDS IN BATCH *
> //***************************************************************
> //STEP1 EXEC PGM=IKJEFT01,PARM='SETRC 5'
> //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> //SYSTSPRT DD SYSOUT=*
> //SYSTSIN DD DUMMY
> //STEP2 EXEC PGM=IEFBR14
> //STEP3 EXEC PGM=IEFBR14
> //STEP4 EXEC PGM=IEFBR14
> //STEP5 EXEC PGM=IKJEFT01,PARM='SETRC 88'
> //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> //SYSTSPRT DD SYSOUT=*
> //SYSTSIN DD DUMMY
> //STEP6 EXEC PGM=IEFBR14
> //STEP7 EXEC PGM=IEFBR14
> //STEP8 EXEC PGM=IEFBR14
> //STEP9 EXEC PGM=IEFBR14
> //RCSTEP EXEC PGM=IKJEFT01,PARM='RCSTEP STEP5'
> //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> //SYSTSPRT DD SYSOUT=*
> //SYSTSIN DD DUMMY
> //STEP10 EXEC PGM=IEFBR14
>
> The SETRC EXEC is as follows
>
> /* rexx */
> exit arg(1)
>
>
> Rob
>
> -----Original Message-----
> From: Lizette Koehler <***@MINDSPRING.COM>
> To: TSO-REXX <TSO-***@VM.MARIST.EDU>
> Sent: Tue, Jun 17, 2014 6:10 am
> Subject: How to get Return Code for previous Step
>
>
> I was going to search the archives, until I saw it would not be that easy.
>
> I hope the Listserver gets upgraded for TSO-REXX so it is easier to
search.
>
> My question.
>
> I am running a two-step job where I want to capture the info from step one
nd use it
> to create a log file as the second step that will provide the ollowing
>
> JOBNAME, JOBNUMBER, Return Code, Date and Time
>
> I have seen the snippets in the past where others have done this in REXX.
>
> If some kind soul could send that again, I would be grateful.
>
> Thanks
>
> Lizette
>
>
> ---------------------------------------------------------------------
> or TSO-REXX subscribe / signoff / archive access instructions, end email
to
> ***@VM.MARIST.EDU with the message: INFO TSO-REXX
>
>
>
> ----------------------------------------------------------------------
> For TSO-REXX subscribe / signoff / archive access instructions, send email
to
> ***@VM.MARIST.EDU with the message: INFO TSO-REXX

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
John P Kalinich
2014-06-18 13:06:09 UTC
Permalink
Why is the "say call isfcalls 'OFF'" included on the following line?

> say jobname jobnum stepname 'RC='steprc say call isfcalls 'OFF'

Regards,
John K

TSO REXX Discussion List <TSO-***@VM.MARIST.EDU> wrote on 06/18/2014
07:34:52 AM:

> From: Lizette Koehler <***@MINDSPRING.COM>
> To: TSO-***@VM.MARIST.EDU
> Date: 06/18/2014 07:35 AM
> Subject: Re: [TSO-REXX] How to get Return Code for previous Step
> Sent by: TSO REXX Discussion List <TSO-***@VM.MARIST.EDU>
>
> Thanks everyone.
>
> All of these examples are going into my code folder for future reference.
>
> And thanks Robert for the extra efforts on my behalf.
>
> Lizette
>
>
> > -----Original Message-----
> > From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On
> > Behalf Of Robert Zenuk
> > Sent: Tuesday, June 17, 2014 5:54 PM
> > To: TSO-***@VM.MARIST.EDU
> > Subject: Re: [TSO-REXX] How to get Return Code for previous Step
> >
> > An update. Some streamlining and I noticed Lizette wanted the step
date
> and time
> > also...
> >
> > /*********************************************************************/
> > /* REXX */
> > /*********************************************************************/
> > /* Purpose: Retrieve the return code from a specific step */
> > /*-------------------------------------------------------------------*/
> > /* Syntax: RCSTEP stepname */
> > /*-------------------------------------------------------------------*/
> > /* Parms: STEPNAME - Step name to get RC */
> > /* */
> > /*********************************************************************/
> > /* Change Log */
> > /* */
> > /* Author Date Reason */
> > /* -------- --------- ----------------------------------------- */
> > /* R. Zenuk Jun 2014 Initial Creation */
> > /* */
> > /*********************************************************************/
> > /* Accept stepname */
> > /*********************************************************************/
> > arg stepname .
> > EXITRC = 0
> > jobname = mvsvar('SYMDEF','JOBNAME')
> > /*********************************************************************/
> > /* Invoke SDSF DA */
> > /*********************************************************************/
> > if isfcalls('ON') <> 0 then exit 99
> > address SDSF "ISFEXEC DA"
> > /*********************************************************************/
> > /* Find the current jobname */
> > /*********************************************************************/
> > do i=1 to isfrows
> > if jname.i = jobname then
> > do
> > jobnum = jobid.i
> > /*********************************************************************/
> > /* Select the jobname and allocate all the output sysout datasets */
> > /*********************************************************************/
> > address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
> > /*********************************************************************/
> > /* Read the JESYSMSG output */
> > /*********************************************************************/
> > address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
> > /*********************************************************************/
> > /* Parse out the STEP and RC (IEF142I) */
> > /*********************************************************************/
> > do l=1 to jobmsgs.0
> > parse var jobmsgs.l msgid . step . . . . . . . steprc .
> > if msgid <> 'IEF142I' then
> > do
> > iterate
> > end
> > else
> > if step = stepname then
> > do
> > steprc = strip(steprc,'L',0)
> > /*********************************************************************/
> > /* Back up and grab the begin (IEF373I) and end time (IEF032I) */
> > /*********************************************************************/
> > b = l - 8
> > parse var jobmsgs.b . . . bdate '.' btime .
> > bdate = left(bdate,4)'.'right(bdate,3)
> > btime = left(btime,2)':'right(btime,2)
> > e = l - 7
> > parse var jobmsgs.e . . . edate '.' etime .
> > edate = left(strip(edate),4)'.'right(edate,3)
> > etime = left(etime,2)':'right(etime,2)
> > leave i
> > end
> > end
> > leave i
> > end
> > end
> > /*********************************************************************/
> > /* Print step details */
> > /*********************************************************************/
> > say jobname jobnum stepname 'RC='steprc bdate btime '-' edate etime
exit
> > EXITRC
> >
> > Rob
> >
> >
> > -----Original Message-----
> > From: robzenuk <***@aol.com>
> > To: TSO-REXX <TSO-***@VM.MARIST.EDU>
> > Sent: Tue, Jun 17, 2014 11:06 am
> > Subject: Re: How to get Return Code for previous Step
> >
> >
> > Here is a program called RCSTEP. It takes the desired STEPNAME as a
parm
> and
> > returns the current jobname, jobnumber, stepname and stepRC. It pulls
the
> IEF142I
> > message from JESYSMSG using SDSF/REXX.
> >
> > /*********************************************************************/
> > /* REXX */
> > /*********************************************************************/
> > /* Purpose: Retrieve the return code from a specific step */
> > /*-------------------------------------------------------------------*/
> > /* Syntax: RCSTEP stepname */
> > /*-------------------------------------------------------------------*/
> > /* Parms: STEPNAME - Step name to get RC */
> > /* */
> > /*********************************************************************/
> > /* Change Log */
> > /* */
> > /* Author Date Reason */
> > /* -------- --------- ----------------------------------------- */
> > /* R. Zenuk Jun 2014 Initial Creation */
> > /* */
> > /*********************************************************************/
> > /* Accept stepname */
> > /*********************************************************************/
> > arg stepname .
> > /*********************************************************************/
> > /* Set Exit Code, the number of bad steps and the current jobname */
> > /*********************************************************************/
> > EXITRC = 0
> > jobname = mvsvar('SYMDEF','JOBNAME')
> > /*********************************************************************/
> > /* Invoke SDSF DA */
> > /*********************************************************************/
> > if isfcalls('ON') <> 0 then exit 99
> > address SDSF "ISFEXEC DA"
> > call isferror 'ISFEXEC'
> > /*********************************************************************/
> > /* Find the current jobname */
> > /*********************************************************************/
> > do i=1 to isfrows
> > if jname.i = jobname then
> > do
> > jobnum = jobid.i
> > /*********************************************************************/
> > /* Select the jobname and allocate all the output sysout datasets */
> > /*********************************************************************/
> > address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
> > call isferror 'ISFACT'
> > /*********************************************************************/
> > /* Read the JESYSMSG output */
> > /*********************************************************************/
> > address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
> > /*********************************************************************/
> > /* Parse out the STEP and RC */
> > /*********************************************************************/
> > do l=1 to jobmsgs.0
> > parse var jobmsgs.l msgid . step . . . . . . . steprc .
> > if msgid <> 'IEF142I' then
> > iterate
> > else
> > if step = stepname then
> > leave
> > end
> > end
> > end
> > /*********************************************************************/
> > /* Summarize the bad steps */
> > /*********************************************************************/
> > say
> > say jobname jobnum stepname 'RC='steprc say call isfcalls 'OFF'
> > exit EXITRC
> > /*********************************************************************/
> > /* SDSF error conditions */
> > /*********************************************************************/
> > isferror: arg sdfscall
> > select
> > /*********************************************************************/
> > /* Ignorable conditions */
> > /*********************************************************************/
> > when isfmsg = '' then return
> > when isfmsg = 'DATA SET ALLOCATED' then return
> > /*********************************************************************/
> > /* Real errors - always RC=16 */
> > /*********************************************************************/
> > otherwise
> > do
> > say isfmsg
> > say
> > do e=1 to isfmsg2.0
> > say sdsfcall right(e,2)':' isfmsg2.e
> > end
> > exit 16
> > end
> > end
> >
> > Some test JCL:
> >
> > //jobcard
> > //***************************************************************
> > //* SDSF/REXX TO ISSUE COMMANDS IN BATCH *
> > //***************************************************************
> > //STEP1 EXEC PGM=IKJEFT01,PARM='SETRC 5'
> > //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> > //SYSTSPRT DD SYSOUT=*
> > //SYSTSIN DD DUMMY
> > //STEP2 EXEC PGM=IEFBR14
> > //STEP3 EXEC PGM=IEFBR14
> > //STEP4 EXEC PGM=IEFBR14
> > //STEP5 EXEC PGM=IKJEFT01,PARM='SETRC 88'
> > //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> > //SYSTSPRT DD SYSOUT=*
> > //SYSTSIN DD DUMMY
> > //STEP6 EXEC PGM=IEFBR14
> > //STEP7 EXEC PGM=IEFBR14
> > //STEP8 EXEC PGM=IEFBR14
> > //STEP9 EXEC PGM=IEFBR14
> > //RCSTEP EXEC PGM=IKJEFT01,PARM='RCSTEP STEP5'
> > //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> > //SYSTSPRT DD SYSOUT=*
> > //SYSTSIN DD DUMMY
> > //STEP10 EXEC PGM=IEFBR14
> >
> > The SETRC EXEC is as follows
> >
> > /* rexx */
> > exit arg(1)
> >
> >
> > Rob
> >
> > -----Original Message-----
> > From: Lizette Koehler <***@MINDSPRING.COM>
> > To: TSO-REXX <TSO-***@VM.MARIST.EDU>
> > Sent: Tue, Jun 17, 2014 6:10 am
> > Subject: How to get Return Code for previous Step
> >
> >
> > I was going to search the archives, until I saw it would not be that
easy.
> >
> > I hope the Listserver gets upgraded for TSO-REXX so it is easier to
> search.
> >
> > My question.
> >
> > I am running a two-step job where I want to capture the info from step
one
> nd use it
> > to create a log file as the second step that will provide the ollowing
> >
> > JOBNAME, JOBNUMBER, Return Code, Date and Time
> >
> > I have seen the snippets in the past where others have done this in
REXX.
> >
> > If some kind soul could send that again, I would be grateful.
> >
> > Thanks
> >
> > Lizette

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Höglund Lars
2014-06-18 14:09:06 UTC
Permalink
Split the rows

say jobname jobnum stepname 'RC='steprc
say
call isfcalls 'OFF'

//Lasse

-----Ursprungligt meddelande-----
Från: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] För John P Kalinich
Skickat: den 18 juni 2014 15:06
Till: TSO-***@VM.MARIST.EDU
Ämne: Re: [TSO-REXX] How to get Return Code for previous Step

Why is the "say call isfcalls 'OFF'" included on the following line?

> say jobname jobnum stepname 'RC='steprc say call isfcalls 'OFF'

Regards,
John K

TSO REXX Discussion List <TSO-***@VM.MARIST.EDU> wrote on 06/18/2014
07:34:52 AM:

> From: Lizette Koehler <***@MINDSPRING.COM>
> To: TSO-***@VM.MARIST.EDU
> Date: 06/18/2014 07:35 AM
> Subject: Re: [TSO-REXX] How to get Return Code for previous Step Sent
> by: TSO REXX Discussion List <TSO-***@VM.MARIST.EDU>
>
> Thanks everyone.
>
> All of these examples are going into my code folder for future reference.
>
> And thanks Robert for the extra efforts on my behalf.
>
> Lizette
>
>
> > -----Original Message-----
> > From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On
> > Behalf Of Robert Zenuk
> > Sent: Tuesday, June 17, 2014 5:54 PM
> > To: TSO-***@VM.MARIST.EDU
> > Subject: Re: [TSO-REXX] How to get Return Code for previous Step
> >
> > An update. Some streamlining and I noticed Lizette wanted the step
date
> and time
> > also...
> >
> > /*********************************************************************/
> > /* REXX */
> > /*********************************************************************/
> > /* Purpose: Retrieve the return code from a specific step */
> > /*-------------------------------------------------------------------*/
> > /* Syntax: RCSTEP stepname */
> > /*-------------------------------------------------------------------*/
> > /* Parms: STEPNAME - Step name to get RC */
> > /* */
> > /*********************************************************************/
> > /* Change Log */
> > /* */
> > /* Author Date Reason */
> > /* -------- --------- ----------------------------------------- */
> > /* R. Zenuk Jun 2014 Initial Creation */
> > /* */
> > /*********************************************************************/
> > /* Accept stepname */
> > /*******************************************************************
> > **/
> > arg stepname .
> > EXITRC = 0
> > jobname = mvsvar('SYMDEF','JOBNAME')
> > /*********************************************************************/
> > /* Invoke SDSF DA */
> > /*******************************************************************
> > **/ if isfcalls('ON') <> 0 then exit 99 address SDSF "ISFEXEC DA"
> > /*********************************************************************/
> > /* Find the current jobname */
> > /*******************************************************************
> > **/
> > do i=1 to isfrows
> > if jname.i = jobname then
> > do
> > jobnum = jobid.i
> > /*********************************************************************/
> > /* Select the jobname and allocate all the output sysout datasets */
> > /*********************************************************************/
> > address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
> > /*********************************************************************/
> > /* Read the JESYSMSG output */
> > /*********************************************************************/
> > address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
> > /*********************************************************************/
> > /* Parse out the STEP and RC (IEF142I) */
> > /*********************************************************************/
> > do l=1 to jobmsgs.0
> > parse var jobmsgs.l msgid . step . . . . . . . steprc .
> > if msgid <> 'IEF142I' then
> > do
> > iterate
> > end
> > else
> > if step = stepname then
> > do
> > steprc = strip(steprc,'L',0)
> > /*********************************************************************/
> > /* Back up and grab the begin (IEF373I) and end time (IEF032I) */
> > /*********************************************************************/
> > b = l - 8
> > parse var jobmsgs.b . . . bdate '.' btime .
> > bdate = left(bdate,4)'.'right(bdate,3)
> > btime = left(btime,2)':'right(btime,2)
> > e = l - 7
> > parse var jobmsgs.e . . . edate '.' etime .
> > edate = left(strip(edate),4)'.'right(edate,3)
> > etime = left(etime,2)':'right(etime,2)
> > leave i
> > end
> > end
> > leave i
> > end
> > end
> > /*********************************************************************/
> > /* Print step details */
> > /*******************************************************************
> > **/ say jobname jobnum stepname 'RC='steprc bdate btime '-' edate
> > etime
exit
> > EXITRC
> >
> > Rob
> >
> >
> > -----Original Message-----
> > From: robzenuk <***@aol.com>
> > To: TSO-REXX <TSO-***@VM.MARIST.EDU>
> > Sent: Tue, Jun 17, 2014 11:06 am
> > Subject: Re: How to get Return Code for previous Step
> >
> >
> > Here is a program called RCSTEP. It takes the desired STEPNAME as a
parm
> and
> > returns the current jobname, jobnumber, stepname and stepRC. It
> > pulls
the
> IEF142I
> > message from JESYSMSG using SDSF/REXX.
> >
> > /*********************************************************************/
> > /* REXX */
> > /*********************************************************************/
> > /* Purpose: Retrieve the return code from a specific step */
> > /*-------------------------------------------------------------------*/
> > /* Syntax: RCSTEP stepname */
> > /*-------------------------------------------------------------------*/
> > /* Parms: STEPNAME - Step name to get RC */
> > /* */
> > /*********************************************************************/
> > /* Change Log */
> > /* */
> > /* Author Date Reason */
> > /* -------- --------- ----------------------------------------- */
> > /* R. Zenuk Jun 2014 Initial Creation */
> > /* */
> > /*********************************************************************/
> > /* Accept stepname */
> > /*******************************************************************
> > **/
> > arg stepname .
> > /*********************************************************************/
> > /* Set Exit Code, the number of bad steps and the current jobname */
> > /*******************************************************************
> > **/
> > EXITRC = 0
> > jobname = mvsvar('SYMDEF','JOBNAME')
> > /*********************************************************************/
> > /* Invoke SDSF DA */
> > /*******************************************************************
> > **/ if isfcalls('ON') <> 0 then exit 99 address SDSF "ISFEXEC DA"
> > call isferror 'ISFEXEC'
> > /*********************************************************************/
> > /* Find the current jobname */
> > /*******************************************************************
> > **/
> > do i=1 to isfrows
> > if jname.i = jobname then
> > do
> > jobnum = jobid.i
> > /*********************************************************************/
> > /* Select the jobname and allocate all the output sysout datasets */
> > /*********************************************************************/
> > address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
> > call isferror 'ISFACT'
> > /*********************************************************************/
> > /* Read the JESYSMSG output */
> > /*********************************************************************/
> > address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
> > /*********************************************************************/
> > /* Parse out the STEP and RC */
> > /*********************************************************************/
> > do l=1 to jobmsgs.0
> > parse var jobmsgs.l msgid . step . . . . . . . steprc .
> > if msgid <> 'IEF142I' then
> > iterate
> > else
> > if step = stepname then
> > leave
> > end
> > end
> > end
> > /*********************************************************************/
> > /* Summarize the bad steps */
> > /*******************************************************************
> > **/
> > say
> > say jobname jobnum stepname 'RC='steprc say call isfcalls 'OFF'
> > exit EXITRC
> > /*********************************************************************/
> > /* SDSF error conditions */
> > /*******************************************************************
> > **/
> > isferror: arg sdfscall
> > select
> > /*********************************************************************/
> > /* Ignorable conditions */
> > /*********************************************************************/
> > when isfmsg = '' then return
> > when isfmsg = 'DATA SET ALLOCATED' then return
> > /*********************************************************************/
> > /* Real errors - always RC=16 */
> > /*********************************************************************/
> > otherwise
> > do
> > say isfmsg
> > say
> > do e=1 to isfmsg2.0
> > say sdsfcall right(e,2)':' isfmsg2.e
> > end
> > exit 16
> > end
> > end
> >
> > Some test JCL:
> >
> > //jobcard
> > //***************************************************************
> > //* SDSF/REXX TO ISSUE COMMANDS IN BATCH *
> > //***************************************************************
> > //STEP1 EXEC PGM=IKJEFT01,PARM='SETRC 5'
> > //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> > //SYSTSPRT DD SYSOUT=*
> > //SYSTSIN DD DUMMY
> > //STEP2 EXEC PGM=IEFBR14
> > //STEP3 EXEC PGM=IEFBR14
> > //STEP4 EXEC PGM=IEFBR14
> > //STEP5 EXEC PGM=IKJEFT01,PARM='SETRC 88'
> > //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> > //SYSTSPRT DD SYSOUT=*
> > //SYSTSIN DD DUMMY
> > //STEP6 EXEC PGM=IEFBR14
> > //STEP7 EXEC PGM=IEFBR14
> > //STEP8 EXEC PGM=IEFBR14
> > //STEP9 EXEC PGM=IEFBR14
> > //RCSTEP EXEC PGM=IKJEFT01,PARM='RCSTEP STEP5'
> > //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> > //SYSTSPRT DD SYSOUT=*
> > //SYSTSIN DD DUMMY
> > //STEP10 EXEC PGM=IEFBR14
> >
> > The SETRC EXEC is as follows
> >
> > /* rexx */
> > exit arg(1)
> >
> >
> > Rob
> >
> > -----Original Message-----
> > From: Lizette Koehler <***@MINDSPRING.COM>
> > To: TSO-REXX <TSO-***@VM.MARIST.EDU>
> > Sent: Tue, Jun 17, 2014 6:10 am
> > Subject: How to get Return Code for previous Step
> >
> >
> > I was going to search the archives, until I saw it would not be that
easy.
> >
> > I hope the Listserver gets upgraded for TSO-REXX so it is easier to
> search.
> >
> > My question.
> >
> > I am running a two-step job where I want to capture the info from
> > step
one
> nd use it
> > to create a log file as the second step that will provide the
> > ollowing
> >
> > JOBNAME, JOBNUMBER, Return Code, Date and Time
> >
> > I have seen the snippets in the past where others have done this in
REXX.
> >
> > If some kind soul could send that again, I would be grateful.
> >
> > Thanks
> >
> > Lizette

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions, send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Höglund Lars
2014-06-18 14:12:50 UTC
Permalink
Wrong again

row1. say jobname jobnum stepname 'RC='steprc
row2. Say
row3. call isfcalls 'OFF'

//L

-----Ursprungligt meddelande-----
Från: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] För Höglund Lars
Skickat: den 18 juni 2014 16:09
Till: TSO-***@VM.MARIST.EDU
Ämne: [TSO-REXX] SV: [TSO-REXX] How to get Return Code for previous Step

Split the rows

say jobname jobnum stepname 'RC='steprc say call isfcalls 'OFF'

//Lasse

-----Ursprungligt meddelande-----
Från: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] För John P Kalinich
Skickat: den 18 juni 2014 15:06
Till: TSO-***@VM.MARIST.EDU
Ämne: Re: [TSO-REXX] How to get Return Code for previous Step

Why is the "say call isfcalls 'OFF'" included on the following line?

> say jobname jobnum stepname 'RC='steprc say call isfcalls 'OFF'

Regards,
John K

TSO REXX Discussion List <TSO-***@VM.MARIST.EDU> wrote on 06/18/2014
07:34:52 AM:

> From: Lizette Koehler <***@MINDSPRING.COM>
> To: TSO-***@VM.MARIST.EDU
> Date: 06/18/2014 07:35 AM
> Subject: Re: [TSO-REXX] How to get Return Code for previous Step Sent
> by: TSO REXX Discussion List <TSO-***@VM.MARIST.EDU>
>
> Thanks everyone.
>
> All of these examples are going into my code folder for future reference.
>
> And thanks Robert for the extra efforts on my behalf.
>
> Lizette
>
>
> > -----Original Message-----
> > From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On
> > Behalf Of Robert Zenuk
> > Sent: Tuesday, June 17, 2014 5:54 PM
> > To: TSO-***@VM.MARIST.EDU
> > Subject: Re: [TSO-REXX] How to get Return Code for previous Step
> >
> > An update. Some streamlining and I noticed Lizette wanted the step
date
> and time
> > also...
> >
> > /*********************************************************************/
> > /* REXX */
> > /*********************************************************************/
> > /* Purpose: Retrieve the return code from a specific step */
> > /*-------------------------------------------------------------------*/
> > /* Syntax: RCSTEP stepname */
> > /*-------------------------------------------------------------------*/
> > /* Parms: STEPNAME - Step name to get RC */
> > /* */
> > /*********************************************************************/
> > /* Change Log */
> > /* */
> > /* Author Date Reason */
> > /* -------- --------- ----------------------------------------- */
> > /* R. Zenuk Jun 2014 Initial Creation */
> > /* */
> > /*********************************************************************/
> > /* Accept stepname */
> > /*******************************************************************
> > **/
> > arg stepname .
> > EXITRC = 0
> > jobname = mvsvar('SYMDEF','JOBNAME')
> > /*********************************************************************/
> > /* Invoke SDSF DA */
> > /*******************************************************************
> > **/ if isfcalls('ON') <> 0 then exit 99 address SDSF "ISFEXEC DA"
> > /*********************************************************************/
> > /* Find the current jobname */
> > /*******************************************************************
> > **/
> > do i=1 to isfrows
> > if jname.i = jobname then
> > do
> > jobnum = jobid.i
> > /*********************************************************************/
> > /* Select the jobname and allocate all the output sysout datasets */
> > /*********************************************************************/
> > address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
> > /*********************************************************************/
> > /* Read the JESYSMSG output */
> > /*********************************************************************/
> > address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
> > /*********************************************************************/
> > /* Parse out the STEP and RC (IEF142I) */
> > /*********************************************************************/
> > do l=1 to jobmsgs.0
> > parse var jobmsgs.l msgid . step . . . . . . . steprc .
> > if msgid <> 'IEF142I' then
> > do
> > iterate
> > end
> > else
> > if step = stepname then
> > do
> > steprc = strip(steprc,'L',0)
> > /*********************************************************************/
> > /* Back up and grab the begin (IEF373I) and end time (IEF032I) */
> > /*********************************************************************/
> > b = l - 8
> > parse var jobmsgs.b . . . bdate '.' btime .
> > bdate = left(bdate,4)'.'right(bdate,3)
> > btime = left(btime,2)':'right(btime,2)
> > e = l - 7
> > parse var jobmsgs.e . . . edate '.' etime .
> > edate = left(strip(edate),4)'.'right(edate,3)
> > etime = left(etime,2)':'right(etime,2)
> > leave i
> > end
> > end
> > leave i
> > end
> > end
> > /*********************************************************************/
> > /* Print step details */
> > /*******************************************************************
> > **/ say jobname jobnum stepname 'RC='steprc bdate btime '-' edate
> > etime
exit
> > EXITRC
> >
> > Rob
> >
> >
> > -----Original Message-----
> > From: robzenuk <***@aol.com>
> > To: TSO-REXX <TSO-***@VM.MARIST.EDU>
> > Sent: Tue, Jun 17, 2014 11:06 am
> > Subject: Re: How to get Return Code for previous Step
> >
> >
> > Here is a program called RCSTEP. It takes the desired STEPNAME as a
parm
> and
> > returns the current jobname, jobnumber, stepname and stepRC. It
> > pulls
the
> IEF142I
> > message from JESYSMSG using SDSF/REXX.
> >
> > /*********************************************************************/
> > /* REXX */
> > /*********************************************************************/
> > /* Purpose: Retrieve the return code from a specific step */
> > /*-------------------------------------------------------------------*/
> > /* Syntax: RCSTEP stepname */
> > /*-------------------------------------------------------------------*/
> > /* Parms: STEPNAME - Step name to get RC */
> > /* */
> > /*********************************************************************/
> > /* Change Log */
> > /* */
> > /* Author Date Reason */
> > /* -------- --------- ----------------------------------------- */
> > /* R. Zenuk Jun 2014 Initial Creation */
> > /* */
> > /*********************************************************************/
> > /* Accept stepname */
> > /*******************************************************************
> > **/
> > arg stepname .
> > /*********************************************************************/
> > /* Set Exit Code, the number of bad steps and the current jobname */
> > /*******************************************************************
> > **/
> > EXITRC = 0
> > jobname = mvsvar('SYMDEF','JOBNAME')
> > /*********************************************************************/
> > /* Invoke SDSF DA */
> > /*******************************************************************
> > **/ if isfcalls('ON') <> 0 then exit 99 address SDSF "ISFEXEC DA"
> > call isferror 'ISFEXEC'
> > /*********************************************************************/
> > /* Find the current jobname */
> > /*******************************************************************
> > **/
> > do i=1 to isfrows
> > if jname.i = jobname then
> > do
> > jobnum = jobid.i
> > /*********************************************************************/
> > /* Select the jobname and allocate all the output sysout datasets */
> > /*********************************************************************/
> > address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
> > call isferror 'ISFACT'
> > /*********************************************************************/
> > /* Read the JESYSMSG output */
> > /*********************************************************************/
> > address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
> > /*********************************************************************/
> > /* Parse out the STEP and RC */
> > /*********************************************************************/
> > do l=1 to jobmsgs.0
> > parse var jobmsgs.l msgid . step . . . . . . . steprc .
> > if msgid <> 'IEF142I' then
> > iterate
> > else
> > if step = stepname then
> > leave
> > end
> > end
> > end
> > /*********************************************************************/
> > /* Summarize the bad steps */
> > /*******************************************************************
> > **/
> > say
> > say jobname jobnum stepname 'RC='steprc say call isfcalls 'OFF'
> > exit EXITRC
> > /*********************************************************************/
> > /* SDSF error conditions */
> > /*******************************************************************
> > **/
> > isferror: arg sdfscall
> > select
> > /*********************************************************************/
> > /* Ignorable conditions */
> > /*********************************************************************/
> > when isfmsg = '' then return
> > when isfmsg = 'DATA SET ALLOCATED' then return
> > /*********************************************************************/
> > /* Real errors - always RC=16 */
> > /*********************************************************************/
> > otherwise
> > do
> > say isfmsg
> > say
> > do e=1 to isfmsg2.0
> > say sdsfcall right(e,2)':' isfmsg2.e
> > end
> > exit 16
> > end
> > end
> >
> > Some test JCL:
> >
> > //jobcard
> > //***************************************************************
> > //* SDSF/REXX TO ISSUE COMMANDS IN BATCH *
> > //***************************************************************
> > //STEP1 EXEC PGM=IKJEFT01,PARM='SETRC 5'
> > //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> > //SYSTSPRT DD SYSOUT=*
> > //SYSTSIN DD DUMMY
> > //STEP2 EXEC PGM=IEFBR14
> > //STEP3 EXEC PGM=IEFBR14
> > //STEP4 EXEC PGM=IEFBR14
> > //STEP5 EXEC PGM=IKJEFT01,PARM='SETRC 88'
> > //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> > //SYSTSPRT DD SYSOUT=*
> > //SYSTSIN DD DUMMY
> > //STEP6 EXEC PGM=IEFBR14
> > //STEP7 EXEC PGM=IEFBR14
> > //STEP8 EXEC PGM=IEFBR14
> > //STEP9 EXEC PGM=IEFBR14
> > //RCSTEP EXEC PGM=IKJEFT01,PARM='RCSTEP STEP5'
> > //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> > //SYSTSPRT DD SYSOUT=*
> > //SYSTSIN DD DUMMY
> > //STEP10 EXEC PGM=IEFBR14
> >
> > The SETRC EXEC is as follows
> >
> > /* rexx */
> > exit arg(1)
> >
> >
> > Rob
> >
> > -----Original Message-----
> > From: Lizette Koehler <***@MINDSPRING.COM>
> > To: TSO-REXX <TSO-***@VM.MARIST.EDU>
> > Sent: Tue, Jun 17, 2014 6:10 am
> > Subject: How to get Return Code for previous Step
> >
> >
> > I was going to search the archives, until I saw it would not be that
easy.
> >
> > I hope the Listserver gets upgraded for TSO-REXX so it is easier to
> search.
> >
> > My question.
> >
> > I am running a two-step job where I want to capture the info from
> > step
one
> nd use it
> > to create a log file as the second step that will provide the
> > ollowing
> >
> > JOBNAME, JOBNUMBER, Return Code, Date and Time
> >
> > I have seen the snippets in the past where others have done this in
REXX.
> >
> > If some kind soul could send that again, I would be grateful.
> >
> > Thanks
> >
> > Lizette

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions, send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions, send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Robert Zenuk
2014-06-18 14:16:56 UTC
Permalink
I do not see that line in my personal copy, my sent folder copy or the copy reply 'd by Lizette...

The say line from the first version sent (where I do see the error in the first forward below) should be:

say jobname jobnum stepname 'RC='steprc

It looks to me like a listserv problem since the next 2 lines are:

say
call isfcalls 'OFF'

Rob


-----Original Message-----
From: John P Kalinich <***@CSC.COM>
To: TSO-REXX <TSO-***@VM.MARIST.EDU>
Sent: Wed, Jun 18, 2014 6:05 am
Subject: Re: How to get Return Code for previous Step


Why is the "say call isfcalls 'OFF'" included on the following line?
> say jobname jobnum stepname 'RC='steprc say call isfcalls 'OFF'
Regards,
ohn K
TSO REXX Discussion List <TSO-***@VM.MARIST.EDU> wrote on 06/18/2014
7:34:52 AM:
> From: Lizette Koehler <***@MINDSPRING.COM>
To: TSO-***@VM.MARIST.EDU
Date: 06/18/2014 07:35 AM
Subject: Re: [TSO-REXX] How to get Return Code for previous Step
Sent by: TSO REXX Discussion List <TSO-***@VM.MARIST.EDU>

Thanks everyone.

All of these examples are going into my code folder for future reference.

And thanks Robert for the extra efforts on my behalf.

Lizette


> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On
> Behalf Of Robert Zenuk
> Sent: Tuesday, June 17, 2014 5:54 PM
> To: TSO-***@VM.MARIST.EDU
> Subject: Re: [TSO-REXX] How to get Return Code for previous Step
>
> An update. Some streamlining and I noticed Lizette wanted the step
ate
and time
> also...
>
> /*********************************************************************/
> /* REXX */
> /*********************************************************************/
> /* Purpose: Retrieve the return code from a specific step */
> /*-------------------------------------------------------------------*/
> /* Syntax: RCSTEP stepname */
> /*-------------------------------------------------------------------*/
> /* Parms: STEPNAME - Step name to get RC */
> /* */
> /*********************************************************************/
> /* Change Log */
> /* */
> /* Author Date Reason */
> /* -------- --------- ----------------------------------------- */
> /* R. Zenuk Jun 2014 Initial Creation */
> /* */
> /*********************************************************************/
> /* Accept stepname */
> /*********************************************************************/
> arg stepname .
> EXITRC = 0
> jobname = mvsvar('SYMDEF','JOBNAME')
> /*********************************************************************/
> /* Invoke SDSF DA */
> /*********************************************************************/
> if isfcalls('ON') <> 0 then exit 99
> address SDSF "ISFEXEC DA"
> /*********************************************************************/
> /* Find the current jobname */
> /*********************************************************************/
> do i=1 to isfrows
> if jname.i = jobname then
> do
> jobnum = jobid.i
> /*********************************************************************/
> /* Select the jobname and allocate all the output sysout datasets */
> /*********************************************************************/
> address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
> /*********************************************************************/
> /* Read the JESYSMSG output */
> /*********************************************************************/
> address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
> /*********************************************************************/
> /* Parse out the STEP and RC (IEF142I) */
> /*********************************************************************/
> do l=1 to jobmsgs.0
> parse var jobmsgs.l msgid . step . . . . . . . steprc .
> if msgid <> 'IEF142I' then
> do
> iterate
> end
> else
> if step = stepname then
> do
> steprc = strip(steprc,'L',0)
> /*********************************************************************/
> /* Back up and grab the begin (IEF373I) and end time (IEF032I) */
> /*********************************************************************/
> b = l - 8
> parse var jobmsgs.b . . . bdate '.' btime .
> bdate = left(bdate,4)'.'right(bdate,3)
> btime = left(btime,2)':'right(btime,2)
> e = l - 7
> parse var jobmsgs.e . . . edate '.' etime .
> edate = left(strip(edate),4)'.'right(edate,3)
> etime = left(etime,2)':'right(etime,2)
> leave i
> end
> end
> leave i
> end
> end
> /*********************************************************************/
> /* Print step details */
> /*********************************************************************/
> say jobname jobnum stepname 'RC='steprc bdate btime '-' edate etime
xit
> EXITRC
>
> Rob
>
>
> -----Original Message-----
> From: robzenuk <***@aol.com>
> To: TSO-REXX <TSO-***@VM.MARIST.EDU>
> Sent: Tue, Jun 17, 2014 11:06 am
> Subject: Re: How to get Return Code for previous Step
>
>
> Here is a program called RCSTEP. It takes the desired STEPNAME as a
arm
and
> returns the current jobname, jobnumber, stepname and stepRC. It pulls
he
IEF142I
> message from JESYSMSG using SDSF/REXX.
>
> /*********************************************************************/
> /* REXX */
> /*********************************************************************/
> /* Purpose: Retrieve the return code from a specific step */
> /*-------------------------------------------------------------------*/
> /* Syntax: RCSTEP stepname */
> /*-------------------------------------------------------------------*/
> /* Parms: STEPNAME - Step name to get RC */
> /* */
> /*********************************************************************/
> /* Change Log */
> /* */
> /* Author Date Reason */
> /* -------- --------- ----------------------------------------- */
> /* R. Zenuk Jun 2014 Initial Creation */
> /* */
> /*********************************************************************/
> /* Accept stepname */
> /*********************************************************************/
> arg stepname .
> /*********************************************************************/
> /* Set Exit Code, the number of bad steps and the current jobname */
> /*********************************************************************/
> EXITRC = 0
> jobname = mvsvar('SYMDEF','JOBNAME')
> /*********************************************************************/
> /* Invoke SDSF DA */
> /*********************************************************************/
> if isfcalls('ON') <> 0 then exit 99
> address SDSF "ISFEXEC DA"
> call isferror 'ISFEXEC'
> /*********************************************************************/
> /* Find the current jobname */
> /*********************************************************************/
> do i=1 to isfrows
> if jname.i = jobname then
> do
> jobnum = jobid.i
> /*********************************************************************/
> /* Select the jobname and allocate all the output sysout datasets */
> /*********************************************************************/
> address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
> call isferror 'ISFACT'
> /*********************************************************************/
> /* Read the JESYSMSG output */
> /*********************************************************************/
> address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
> /*********************************************************************/
> /* Parse out the STEP and RC */
> /*********************************************************************/
> do l=1 to jobmsgs.0
> parse var jobmsgs.l msgid . step . . . . . . . steprc .
> if msgid <> 'IEF142I' then
> iterate
> else
> if step = stepname then
> leave
> end
> end
> end
> /*********************************************************************/
> /* Summarize the bad steps */
> /*********************************************************************/
> say
> say jobname jobnum stepname 'RC='steprc say call isfcalls 'OFF'
> exit EXITRC
> /*********************************************************************/
> /* SDSF error conditions */
> /*********************************************************************/
> isferror: arg sdfscall
> select
> /*********************************************************************/
> /* Ignorable conditions */
> /*********************************************************************/
> when isfmsg = '' then return
> when isfmsg = 'DATA SET ALLOCATED' then return
> /*********************************************************************/
> /* Real errors - always RC=16 */
> /*********************************************************************/
> otherwise
> do
> say isfmsg
> say
> do e=1 to isfmsg2.0
> say sdsfcall right(e,2)':' isfmsg2.e
> end
> exit 16
> end
> end
>
> Some test JCL:
>
> //jobcard
> //***************************************************************
> //* SDSF/REXX TO ISSUE COMMANDS IN BATCH *
> //***************************************************************
> //STEP1 EXEC PGM=IKJEFT01,PARM='SETRC 5'
> //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> //SYSTSPRT DD SYSOUT=*
> //SYSTSIN DD DUMMY
> //STEP2 EXEC PGM=IEFBR14
> //STEP3 EXEC PGM=IEFBR14
> //STEP4 EXEC PGM=IEFBR14
> //STEP5 EXEC PGM=IKJEFT01,PARM='SETRC 88'
> //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> //SYSTSPRT DD SYSOUT=*
> //SYSTSIN DD DUMMY
> //STEP6 EXEC PGM=IEFBR14
> //STEP7 EXEC PGM=IEFBR14
> //STEP8 EXEC PGM=IEFBR14
> //STEP9 EXEC PGM=IEFBR14
> //RCSTEP EXEC PGM=IKJEFT01,PARM='RCSTEP STEP5'
> //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> //SYSTSPRT DD SYSOUT=*
> //SYSTSIN DD DUMMY
> //STEP10 EXEC PGM=IEFBR14
>
> The SETRC EXEC is as follows
>
> /* rexx */
> exit arg(1)
>
>
> Rob
>
> -----Original Message-----
> From: Lizette Koehler <***@MINDSPRING.COM>
> To: TSO-REXX <TSO-***@VM.MARIST.EDU>
> Sent: Tue, Jun 17, 2014 6:10 am
> Subject: How to get Return Code for previous Step
>
>
> I was going to search the archives, until I saw it would not be that
asy.
>
> I hope the Listserver gets upgraded for TSO-REXX so it is easier to
search.
>
> My question.
>
> I am running a two-step job where I want to capture the info from step
ne
nd use it
> to create a log file as the second step that will provide the ollowing
>
> JOBNAME, JOBNUMBER, Return Code, Date and Time
>
> I have seen the snippets in the past where others have done this in
EXX.
>
> If some kind soul could send that again, I would be grateful.
>
> Thanks
>
> Lizette
----------------------------------------------------------------------
or TSO-REXX subscribe / signoff / archive access instructions,
end email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX


----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Höglund Lars
2014-06-19 12:32:51 UTC
Permalink
Running z/OS 2.1 and then we are going forward to fetch Start and End time

Like:

if msgid <> 'IEF142I' then
iterate
else
/* we found the message... */
if step = stepname then
do
/* ...for the searched step */
steprc = strip(steprc,'L',0)
/***************************************************/
/* go on and grab the begin (IEF373I) */
/* and end time (IEF032I) */
/* */
/* IEF373I STEP/STEP4 /START 2014170.1400 */
/* IEF032I STEP/STEP4 /STOP 2014170.1400 */
/* CPU: 0 HR 00 MIN 00.00 -> below same row */
/* SEC SRB: 0 HR 00 MIN 00.00 SEC */
/***************************************************/
do b=l+1 to JOBMSGS.0
parse var JOBMSGS.b msgid .
if msgid = 'IEF373I' then
do
parse var JOBMSGS.b . . . bdate '.' btime .
bdate = left(bdate,4)'.'right(bdate,3)
btime = left(btime,2)':'right(btime,2)
iterate
end
if msgid = 'IEF032I' then
do
parse var JOBMSGS.b . . . edate '.' etime .
edate = left(strip(edate),4)'.'right(edate,3)
etime = left(etime,2)':'right(etime,2)
leave i
end
end /*do b=l+1 to JOBMSGS.0*/
end

//Lasse

-----Ursprungligt meddelande-----
Från: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] För Robert Zenuk
Skickat: den 18 juni 2014 16:18
Till: TSO-***@VM.MARIST.EDU
Ämne: Re: [TSO-REXX] How to get Return Code for previous Step

I do not see that line in my personal copy, my sent folder copy or the copy reply 'd by Lizette...

The say line from the first version sent (where I do see the error in the first forward below) should be:

say jobname jobnum stepname 'RC='steprc

It looks to me like a listserv problem since the next 2 lines are:

say
call isfcalls 'OFF'

Rob


-----Original Message-----
From: John P Kalinich <***@CSC.COM<mailto:***@CSC.COM>>
To: TSO-REXX <TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>>
Sent: Wed, Jun 18, 2014 6:05 am
Subject: Re: How to get Return Code for previous Step


Why is the "say call isfcalls 'OFF'" included on the following line?
> say jobname jobnum stepname 'RC='steprc say call isfcalls 'OFF'
Regards,
ohn K
TSO REXX Discussion List <TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>> wrote on 06/18/2014
7:34:52 AM:
> From: Lizette Koehler <***@MINDSPRING.COM<mailto:***@MINDSPRING.COM>>
To: TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>
Date: 06/18/2014 07:35 AM
Subject: Re: [TSO-REXX] How to get Return Code for previous Step Sent by: TSO REXX Discussion List <TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>>

Thanks everyone.

All of these examples are going into my code folder for future reference.

And thanks Robert for the extra efforts on my behalf.

Lizette


> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On > Behalf Of Robert Zenuk > Sent: Tuesday, June 17, 2014 5:54 PM > To: TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU> > Subject: Re: [TSO-REXX] How to get Return Code for previous Step > > An update. Some streamlining and I noticed Lizette wanted the step ate and time > also...
>
> /*********************************************************************/
> /* REXX */
> /*********************************************************************/
> /* Purpose: Retrieve the return code from a specific step */
> /*-------------------------------------------------------------------*/
> /* Syntax: RCSTEP stepname */
> /*-------------------------------------------------------------------*/
> /* Parms: STEPNAME - Step name to get RC */
> /* */
> /*********************************************************************/
> /* Change Log */
> /* */
> /* Author Date Reason */
> /* -------- --------- ----------------------------------------- */
> /* R. Zenuk Jun 2014 Initial Creation */
> /* */
> /*********************************************************************/
> /* Accept stepname */
> /*********************************************************************/
> arg stepname .
> EXITRC = 0
> jobname = mvsvar('SYMDEF','JOBNAME') > /*********************************************************************/
> /* Invoke SDSF DA */
> /*********************************************************************/
> if isfcalls('ON') <> 0 then exit 99
> address SDSF "ISFEXEC DA"
> /*********************************************************************/
> /* Find the current jobname */
> /*********************************************************************/
> do i=1 to isfrows
> if jname.i = jobname then
> do
> jobnum = jobid.i
> /*********************************************************************/
> /* Select the jobname and allocate all the output sysout datasets */
> /*********************************************************************/
> address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
> /*********************************************************************/
> /* Read the JESYSMSG output */
> /*********************************************************************/
> address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
> /*********************************************************************/
> /* Parse out the STEP and RC (IEF142I) */
> /*********************************************************************/
> do l=1 to jobmsgs.0
> parse var jobmsgs.l msgid . step . . . . . . . steprc .
> if msgid <> 'IEF142I' then
> do
> iterate
> end
> else
> if step = stepname then
> do
> steprc = strip(steprc,'L',0)
> /*********************************************************************/
> /* Back up and grab the begin (IEF373I) and end time (IEF032I) */
> /*********************************************************************/
> b = l - 8
> parse var jobmsgs.b . . . bdate '.' btime .
> bdate = left(bdate,4)'.'right(bdate,3)
> btime = left(btime,2)':'right(btime,2)
> e = l - 7
> parse var jobmsgs.e . . . edate '.' etime .
> edate = left(strip(edate),4)'.'right(edate,3)
> etime = left(etime,2)':'right(etime,2)
> leave i
> end
> end
> leave i
> end
> end
> /*********************************************************************/
> /* Print step details */
> /*********************************************************************/
> say jobname jobnum stepname 'RC='steprc bdate btime '-' edate etime xit > EXITRC > > Rob > > > -----Original Message----- > From: robzenuk <***@aol.com<mailto:***@aol.com>> > To: TSO-REXX <TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>> > Sent: Tue, Jun 17, 2014 11:06 am > Subject: Re: How to get Return Code for previous Step > > > Here is a program called RCSTEP. It takes the desired STEPNAME as a arm and > returns the current jobname, jobnumber, stepname and stepRC. It pulls he IEF142I > message from JESYSMSG using SDSF/REXX.
>
> /*********************************************************************/
> /* REXX */
> /*********************************************************************/
> /* Purpose: Retrieve the return code from a specific step */
> /*-------------------------------------------------------------------*/
> /* Syntax: RCSTEP stepname */
> /*-------------------------------------------------------------------*/
> /* Parms: STEPNAME - Step name to get RC */
> /* */
> /*********************************************************************/
> /* Change Log */
> /* */
> /* Author Date Reason */
> /* -------- --------- ----------------------------------------- */
> /* R. Zenuk Jun 2014 Initial Creation */
> /* */
> /*********************************************************************/
> /* Accept stepname */
> /*********************************************************************/
> arg stepname .
> /*********************************************************************/
> /* Set Exit Code, the number of bad steps and the current jobname */
> /*********************************************************************/
> EXITRC = 0
> jobname = mvsvar('SYMDEF','JOBNAME') > /*********************************************************************/
> /* Invoke SDSF DA */
> /*********************************************************************/
> if isfcalls('ON') <> 0 then exit 99
> address SDSF "ISFEXEC DA"
> call isferror 'ISFEXEC'
> /*********************************************************************/
> /* Find the current jobname */
> /*********************************************************************/
> do i=1 to isfrows
> if jname.i = jobname then
> do
> jobnum = jobid.i
> /*********************************************************************/
> /* Select the jobname and allocate all the output sysout datasets */
> /*********************************************************************/
> address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
> call isferror 'ISFACT'
> /*********************************************************************/
> /* Read the JESYSMSG output */
> /*********************************************************************/
> address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
> /*********************************************************************/
> /* Parse out the STEP and RC */
> /*********************************************************************/
> do l=1 to jobmsgs.0
> parse var jobmsgs.l msgid . step . . . . . . . steprc .
> if msgid <> 'IEF142I' then
> iterate
> else
> if step = stepname then
> leave
> end
> end
> end
> /*********************************************************************/
> /* Summarize the bad steps */
> /*********************************************************************/
> say
> say jobname jobnum stepname 'RC='steprc say call isfcalls 'OFF'
> exit EXITRC
> /*********************************************************************/
> /* SDSF error conditions */
> /*********************************************************************/
> isferror: arg sdfscall
> select
> /*********************************************************************/
> /* Ignorable conditions */
> /*********************************************************************/
> when isfmsg = '' then return
> when isfmsg = 'DATA SET ALLOCATED' then return
> /*********************************************************************/
> /* Real errors - always RC=16 */
> /*********************************************************************/
> otherwise
> do
> say isfmsg
> say
> do e=1 to isfmsg2.0
> say sdsfcall right(e,2)':' isfmsg2.e
> end
> exit 16
> end
> end
>
> Some test JCL:
>
> //jobcard
> //***************************************************************
> //* SDSF/REXX TO ISSUE COMMANDS IN BATCH *
> //***************************************************************
> //STEP1 EXEC PGM=IKJEFT01,PARM='SETRC 5'
> //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> //SYSTSPRT DD SYSOUT=*
> //SYSTSIN DD DUMMY
> //STEP2 EXEC PGM=IEFBR14
> //STEP3 EXEC PGM=IEFBR14
> //STEP4 EXEC PGM=IEFBR14
> //STEP5 EXEC PGM=IKJEFT01,PARM='SETRC 88'
> //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> //SYSTSPRT DD SYSOUT=*
> //SYSTSIN DD DUMMY
> //STEP6 EXEC PGM=IEFBR14
> //STEP7 EXEC PGM=IEFBR14
> //STEP8 EXEC PGM=IEFBR14
> //STEP9 EXEC PGM=IEFBR14
> //RCSTEP EXEC PGM=IKJEFT01,PARM='RCSTEP STEP5'
> //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> //SYSTSPRT DD SYSOUT=*
> //SYSTSIN DD DUMMY
> //STEP10 EXEC PGM=IEFBR14
>
> The SETRC EXEC is as follows
>
> /* rexx */
> exit arg(1)
>
>
> Rob
>
> -----Original Message-----
> From: Lizette Koehler <***@MINDSPRING.COM<mailto:***@MINDSPRING.COM>> > To: TSO-REXX <TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>> > Sent: Tue, Jun 17, 2014 6:10 am > Subject: How to get Return Code for previous Step > > > I was going to search the archives, until I saw it would not be that asy.
>
> I hope the Listserver gets upgraded for TSO-REXX so it is easier to search.
>
> My question.
>
> I am running a two-step job where I want to capture the info from step ne nd use it > to create a log file as the second step that will provide the ollowing > > JOBNAME, JOBNUMBER, Return Code, Date and Time > > I have seen the snippets in the past where others have done this in EXX.
>
> If some kind soul could send that again, I would be grateful.
>
> Thanks
>
> Lizette
----------------------------------------------------------------------
or TSO-REXX subscribe / signoff / archive access instructions, end email to ***@VM.MARIST.EDU<mailto:***@VM.MARIST.EDU> with the message: INFO TSO-REXX


----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions, send email to ***@VM.MARIST.EDU<mailto:***@VM.MARIST.EDU> with the message: INFO TSO-REXX


----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Robert Zenuk
2014-06-19 13:59:58 UTC
Permalink
DOH! You're right. We have some z/OS 2.1 test systems. And... This is true on our z/OS 1.13 production systems also. Sorry for the confusion the IEF373I and IEF032I messages DO follow the IEF142I message in the 2 cases I have visibility too... Thanks Lars!


Here is the updated code:



/*********************************************************************/
/* REXX */
/*********************************************************************/
/* Purpose: Retrieve the return code from a specific step */
/*-------------------------------------------------------------------*/
/* Syntax: RCSTEP stepname */
/*-------------------------------------------------------------------*/
/* Parms: STEPNAME - Step name to get RC */
/* */
/*********************************************************************/
/* Change Log */
/* */
/* Author Date Reason */
/* -------- --------- ----------------------------------------- */
/* R. Zenuk Jun 2014 Initial Creation */
/* L. Hoglund 06/19/14 Fixed to find CORRECT IEF373I and IEF032I */
/* */
/*********************************************************************/
/* Accept stepname */
/*********************************************************************/
arg stepname .
EXITRC = 0
jobname = mvsvar('SYMDEF','JOBNAME')
/*********************************************************************/
/* Invoke SDSF DA */
/*********************************************************************/
if isfcalls('ON') <> 0 then exit 99
address SDSF "ISFEXEC DA"
/*********************************************************************/
/* Find the current jobname */
/*********************************************************************/
do i=1 to isfrows
if jname.i = jobname then
do
jobnum = jobid.i
/*********************************************************************/
/* Select the jobname and allocate all the output sysout datasets */
/*********************************************************************/
address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
/*********************************************************************/
/* Read the JESYSMSG output */
/*********************************************************************/
address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
/*********************************************************************/
/* Parse out the STEP and RC (IEF142I) */
/*********************************************************************/
do l=1 to jobmsgs.0
parse var jobmsgs.l msgid . step . . . . . . . steprc .
if msgid <> 'IEF142I' then
do
iterate
end
else
if step = stepname then
do
steprc = strip(steprc,'L',0)
/*********************************************************************/
/* Back up and grab the begin (IEF373I) and end time (IEF032I) */
/*********************************************************************/
do b=l+1 to jobmsgs.0
parse var jobmsgs.b msgid .
if msgid = 'IEF373I' then
do
parse var jobmsgs.b . . . bdate '.' btime .
bdate = left(bdate,4)'.'right(bdate,3)
btime = left(btime,2)':'right(btime,2)
end
if msgid = 'IEF032I' then
do
parse var jobmsgs.b . . . edate '.' etime .
edate = left(strip(edate),4)'.'right(edate,3)
etime = left(etime,2)':'right(etime,2)
leave i
end
end
end
end
leave i
end
end
/*********************************************************************/
/* Print step details */
/*********************************************************************/
say jobname jobnum stepname 'RC='steprc bdate btime '-' edate etime
exit EXITRC





Rob



-----Original Message-----
From: Höglund Lars <***@ALECTA.SE>
To: TSO-REXX <TSO-***@VM.MARIST.EDU>
Sent: Thu, Jun 19, 2014 5:32 am
Subject: SV: [TSO-REXX] How to get Return Code for previous Step


Running z/OS 2.1 and then we are going forward to fetch Start and End time

Like:

if msgid <> 'IEF142I' then
iterate
else
/* we found the message... */
if step = stepname then
do
/* ...for the searched step */
steprc = strip(steprc,'L',0)
/***************************************************/
/* go on and grab the begin (IEF373I) */
/* and end time (IEF032I) */
/* */
/* IEF373I STEP/STEP4 /START 2014170.1400 */
/* IEF032I STEP/STEP4 /STOP 2014170.1400 */
/* CPU: 0 HR 00 MIN 00.00 -> below same row */
/* SEC SRB: 0 HR 00 MIN 00.00 SEC */
/***************************************************/
do b=l+1 to JOBMSGS.0
parse var JOBMSGS.b msgid .
if msgid = 'IEF373I' then
do
parse var JOBMSGS.b . . . bdate '.' btime .
bdate = left(bdate,4)'.'right(bdate,3)
btime = left(btime,2)':'right(btime,2)
iterate
end
if msgid = 'IEF032I' then
do
parse var JOBMSGS.b . . . edate '.' etime .
edate = left(strip(edate),4)'.'right(edate,3)
etime = left(etime,2)':'right(etime,2)
leave i
end
end /*do b=l+1 to JOBMSGS.0*/
end

//Lasse

-----Ursprungligt meddelande-----
Från: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] För Robert Zenuk
Skickat: den 18 juni 2014 16:18
Till: TSO-***@VM.MARIST.EDU
Ämne: Re: [TSO-REXX] How to get Return Code for previous Step

I do not see that line in my personal copy, my sent folder copy or the copy
reply 'd by Lizette...

The say line from the first version sent (where I do see the error in the first
forward below) should be:

say jobname jobnum stepname 'RC='steprc

It looks to me like a listserv problem since the next 2 lines are:

say
call isfcalls 'OFF'

Rob


-----Original Message-----
From: John P Kalinich <***@CSC.COM<mailto:***@CSC.COM>>
To: TSO-REXX <TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>>
Sent: Wed, Jun 18, 2014 6:05 am
Subject: Re: How to get Return Code for previous Step


Why is the "say call isfcalls 'OFF'" included on the following line?
> say jobname jobnum stepname 'RC='steprc say call isfcalls 'OFF'
Regards,
ohn K
TSO REXX Discussion List <TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>>
wrote on 06/18/2014
7:34:52 AM:
> From: Lizette Koehler <***@MINDSPRING.COM<mailto:***@MINDSPRING.COM>>
To: TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>
Date: 06/18/2014 07:35 AM
Subject: Re: [TSO-REXX] How to get Return Code for previous Step Sent by: TSO
REXX Discussion List <TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>>

Thanks everyone.

All of these examples are going into my code folder for future reference.

And thanks Robert for the extra efforts on my behalf.

Lizette


> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On > Behalf
Of Robert Zenuk > Sent: Tuesday, June 17, 2014 5:54 PM > To:
TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU> > Subject: Re: [TSO-REXX]
How to get Return Code for previous Step > > An update. Some streamlining and
I noticed Lizette wanted the step ate and time > also...
>
> /*********************************************************************/
> /* REXX */
> /*********************************************************************/
> /* Purpose: Retrieve the return code from a specific step */
> /*-------------------------------------------------------------------*/
> /* Syntax: RCSTEP stepname */
> /*-------------------------------------------------------------------*/
> /* Parms: STEPNAME - Step name to get RC */
> /* */
> /*********************************************************************/
> /* Change Log */
> /* */
> /* Author Date Reason */
> /* -------- --------- ----------------------------------------- */
> /* R. Zenuk Jun 2014 Initial Creation */
> /* */
> /*********************************************************************/
> /* Accept stepname */
> /*********************************************************************/
> arg stepname .
> EXITRC = 0
> jobname = mvsvar('SYMDEF','JOBNAME') > /*********************************************************************/
> /* Invoke SDSF DA */
> /*********************************************************************/
> if isfcalls('ON') <> 0 then exit 99
> address SDSF "ISFEXEC DA"
> /*********************************************************************/
> /* Find the current jobname */
> /*********************************************************************/
> do i=1 to isfrows
> if jname.i = jobname then
> do
> jobnum = jobid.i
> /*********************************************************************/
> /* Select the jobname and allocate all the output sysout datasets */
> /*********************************************************************/
> address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
> /*********************************************************************/
> /* Read the JESYSMSG output */
> /*********************************************************************/
> address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
> /*********************************************************************/
> /* Parse out the STEP and RC (IEF142I) */
> /*********************************************************************/
> do l=1 to jobmsgs.0
> parse var jobmsgs.l msgid . step . . . . . . . steprc .
> if msgid <> 'IEF142I' then
> do
> iterate
> end
> else
> if step = stepname then
> do
> steprc = strip(steprc,'L',0)
> /*********************************************************************/
> /* Back up and grab the begin (IEF373I) and end time (IEF032I) */
> /*********************************************************************/
> b = l - 8
> parse var jobmsgs.b . . . bdate '.' btime .
> bdate = left(bdate,4)'.'right(bdate,3)
> btime = left(btime,2)':'right(btime,2)
> e = l - 7
> parse var jobmsgs.e . . . edate '.' etime .
> edate = left(strip(edate),4)'.'right(edate,3)
> etime = left(etime,2)':'right(etime,2)
> leave i
> end
> end
> leave i
> end
> end
> /*********************************************************************/
> /* Print step details */
> /*********************************************************************/
> say jobname jobnum stepname 'RC='steprc bdate btime '-' edate etime xit >
EXITRC > > Rob > > > -----Original Message----- > From: robzenuk
<***@aol.com<mailto:***@aol.com>> > To: TSO-REXX <TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>>
> Sent: Tue, Jun 17, 2014 11:06 am > Subject: Re: How to get Return Code for
previous Step > > > Here is a program called RCSTEP. It takes the desired
STEPNAME as a arm and > returns the current jobname, jobnumber, stepname and
stepRC. It pulls he IEF142I > message from JESYSMSG using SDSF/REXX.
>
> /*********************************************************************/
> /* REXX */
> /*********************************************************************/
> /* Purpose: Retrieve the return code from a specific step */
> /*-------------------------------------------------------------------*/
> /* Syntax: RCSTEP stepname */
> /*-------------------------------------------------------------------*/
> /* Parms: STEPNAME - Step name to get RC */
> /* */
> /*********************************************************************/
> /* Change Log */
> /* */
> /* Author Date Reason */
> /* -------- --------- ----------------------------------------- */
> /* R. Zenuk Jun 2014 Initial Creation */
> /* */
> /*********************************************************************/
> /* Accept stepname */
> /*********************************************************************/
> arg stepname .
> /*********************************************************************/
> /* Set Exit Code, the number of bad steps and the current jobname */
> /*********************************************************************/
> EXITRC = 0
> jobname = mvsvar('SYMDEF','JOBNAME') > /*********************************************************************/
> /* Invoke SDSF DA */
> /*********************************************************************/
> if isfcalls('ON') <> 0 then exit 99
> address SDSF "ISFEXEC DA"
> call isferror 'ISFEXEC'
> /*********************************************************************/
> /* Find the current jobname */
> /*********************************************************************/
> do i=1 to isfrows
> if jname.i = jobname then
> do
> jobnum = jobid.i
> /*********************************************************************/
> /* Select the jobname and allocate all the output sysout datasets */
> /*********************************************************************/
> address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
> call isferror 'ISFACT'
> /*********************************************************************/
> /* Read the JESYSMSG output */
> /*********************************************************************/
> address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
> /*********************************************************************/
> /* Parse out the STEP and RC */
> /*********************************************************************/
> do l=1 to jobmsgs.0
> parse var jobmsgs.l msgid . step . . . . . . . steprc .
> if msgid <> 'IEF142I' then
> iterate
> else
> if step = stepname then
> leave
> end
> end
> end
> /*********************************************************************/
> /* Summarize the bad steps */
> /*********************************************************************/
> say
> say jobname jobnum stepname 'RC='steprc say call isfcalls 'OFF'
> exit EXITRC
> /*********************************************************************/
> /* SDSF error conditions */
> /*********************************************************************/
> isferror: arg sdfscall
> select
> /*********************************************************************/
> /* Ignorable conditions */
> /*********************************************************************/
> when isfmsg = '' then return
> when isfmsg = 'DATA SET ALLOCATED' then return
> /*********************************************************************/
> /* Real errors - always RC=16 */
> /*********************************************************************/
> otherwise
> do
> say isfmsg
> say
> do e=1 to isfmsg2.0
> say sdsfcall right(e,2)':' isfmsg2.e
> end
> exit 16
> end
> end
>
> Some test JCL:
>
> //jobcard
> //***************************************************************
> //* SDSF/REXX TO ISSUE COMMANDS IN BATCH *
> //***************************************************************
> //STEP1 EXEC PGM=IKJEFT01,PARM='SETRC 5'
> //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> //SYSTSPRT DD SYSOUT=*
> //SYSTSIN DD DUMMY
> //STEP2 EXEC PGM=IEFBR14
> //STEP3 EXEC PGM=IEFBR14
> //STEP4 EXEC PGM=IEFBR14
> //STEP5 EXEC PGM=IKJEFT01,PARM='SETRC 88'
> //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> //SYSTSPRT DD SYSOUT=*
> //SYSTSIN DD DUMMY
> //STEP6 EXEC PGM=IEFBR14
> //STEP7 EXEC PGM=IEFBR14
> //STEP8 EXEC PGM=IEFBR14
> //STEP9 EXEC PGM=IEFBR14
> //RCSTEP EXEC PGM=IKJEFT01,PARM='RCSTEP STEP5'
> //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> //SYSTSPRT DD SYSOUT=*
> //SYSTSIN DD DUMMY
> //STEP10 EXEC PGM=IEFBR14
>
> The SETRC EXEC is as follows
>
> /* rexx */
> exit arg(1)
>
>
> Rob
>
> -----Original Message-----
> From: Lizette Koehler <***@MINDSPRING.COM<mailto:***@MINDSPRING.COM>>
> To: TSO-REXX <TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>> > Sent:
Tue, Jun 17, 2014 6:10 am > Subject: How to get Return Code for previous Step
> > > I was going to search the archives, until I saw it would not be that
asy.
>
> I hope the Listserver gets upgraded for TSO-REXX so it is easier to search.
>
> My question.
>
> I am running a two-step job where I want to capture the info from step ne nd
use it > to create a log file as the second step that will provide the ollowing
> > JOBNAME, JOBNUMBER, Return Code, Date and Time > > I have seen the
snippets in the past where others have done this in EXX.
>
> If some kind soul could send that again, I would be grateful.
>
> Thanks
>
> Lizette
----------------------------------------------------------------------
or TSO-REXX subscribe / signoff / archive access instructions, end email to
***@VM.MARIST.EDU<mailto:***@VM.MARIST.EDU> with the message: INFO
TSO-REXX


----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions, send email to
***@VM.MARIST.EDU<mailto:***@VM.MARIST.EDU> with the message: INFO
TSO-REXX


----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX




----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Sokolsky, Hayim Z.
2014-06-19 14:54:20 UTC
Permalink
I've got some questions ....

1. Why not use
isfprefix= jobname
prior to
address SDSF "ISFEXEC DA"

This limits the output of the ISFEXEC DA to only jobs that match your jobname.

2. How do you know this is "you"? In asking the question I realized that almost all installations disallow duplication job names, therefore ISFEXEC DA is fine. But if you are using this in a started task, the question still remains. There is no lookup on job number.

I have not coded up a solution. Nonetheless, it should be simple enough to check the ASID of the active task, versus the ISFEXEC DA output to provide this match.

Hayim Sokolsky
Manager, Mainframe Security Architecture
Technology Risk Management
DTCC Tampa
Direct: +1 813 470-2177 | ***@dtcc.com



Visit us at www.dtcc.com or follow us on Twitter @The_DTCC  and on LinkedIn.
To learn about career opportunities at DTCC, please visit dtcc.com/careers.

Classification: DTCC Non-Confidential (WHITE)

The views I have expressed in this email are my own personal views, and are not endorsed or supported by, and do not necessarily express or reflect, the views, positions or strategies of my employer.



-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On Behalf Of Robert Zenuk
Sent: Thursday, June 19, 2014 10:00
To: TSO-***@VM.MARIST.EDU
Subject: Re: [TSO-REXX] SV: [TSO-REXX] How to get Return Code for previous Step

DOH! You're right. We have some z/OS 2.1 test systems. And... This is true on our z/OS 1.13 production systems also. Sorry for the confusion the IEF373I and IEF032I messages DO follow the IEF142I message in the 2 cases I have visibility too... Thanks Lars!


Here is the updated code:



/*********************************************************************/
/* REXX */
/*********************************************************************/
/* Purpose: Retrieve the return code from a specific step */
/*-------------------------------------------------------------------*/
/* Syntax: RCSTEP stepname */
/*-------------------------------------------------------------------*/
/* Parms: STEPNAME - Step name to get RC */
/* */
/*********************************************************************/
/* Change Log */
/* */
/* Author Date Reason */
/* -------- --------- ----------------------------------------- */
/* R. Zenuk Jun 2014 Initial Creation */
/* L. Hoglund 06/19/14 Fixed to find CORRECT IEF373I and IEF032I */
/* */
/*********************************************************************/
/* Accept stepname */
/*********************************************************************/
arg stepname .
EXITRC = 0
jobname = mvsvar('SYMDEF','JOBNAME')
/*********************************************************************/
/* Invoke SDSF DA */
/*********************************************************************/
if isfcalls('ON') <> 0 then exit 99
address SDSF "ISFEXEC DA"
/*********************************************************************/
/* Find the current jobname */
/*********************************************************************/
do i=1 to isfrows
if jname.i = jobname then
do
jobnum = jobid.i
/*********************************************************************/
/* Select the jobname and allocate all the output sysout datasets */
/*********************************************************************/
address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
/*********************************************************************/
/* Read the JESYSMSG output */
/*********************************************************************/
address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
/*********************************************************************/
/* Parse out the STEP and RC (IEF142I) */
/*********************************************************************/
do l=1 to jobmsgs.0
parse var jobmsgs.l msgid . step . . . . . . . steprc .
if msgid <> 'IEF142I' then
do
iterate
end
else
if step = stepname then
do
steprc = strip(steprc,'L',0)
/*********************************************************************/
/* Back up and grab the begin (IEF373I) and end time (IEF032I) */
/*********************************************************************/
do b=l+1 to jobmsgs.0
parse var jobmsgs.b msgid .
if msgid = 'IEF373I' then
do
parse var jobmsgs.b . . . bdate '.' btime .
bdate = left(bdate,4)'.'right(bdate,3)
btime = left(btime,2)':'right(btime,2)
end
if msgid = 'IEF032I' then
do
parse var jobmsgs.b . . . edate '.' etime .
edate = left(strip(edate),4)'.'right(edate,3)
etime = left(etime,2)':'right(etime,2)
leave i
end
end
end
end
leave i
end
end
/*********************************************************************/
/* Print step details */
/*********************************************************************/
say jobname jobnum stepname 'RC='steprc bdate btime '-' edate etime
exit EXITRC





Rob



-----Original Message-----
From: Höglund Lars <***@ALECTA.SE>
To: TSO-REXX <TSO-***@VM.MARIST.EDU>
Sent: Thu, Jun 19, 2014 5:32 am
Subject: SV: [TSO-REXX] How to get Return Code for previous Step


Running z/OS 2.1 and then we are going forward to fetch Start and End time

Like:

if msgid <> 'IEF142I' then
iterate
else
/* we found the message... */
if step = stepname then
do
/* ...for the searched step */
steprc = strip(steprc,'L',0)
/***************************************************/
/* go on and grab the begin (IEF373I) */
/* and end time (IEF032I) */
/* */
/* IEF373I STEP/STEP4 /START 2014170.1400 */
/* IEF032I STEP/STEP4 /STOP 2014170.1400 */
/* CPU: 0 HR 00 MIN 00.00 -> below same row */
/* SEC SRB: 0 HR 00 MIN 00.00 SEC */
/***************************************************/
do b=l+1 to JOBMSGS.0
parse var JOBMSGS.b msgid .
if msgid = 'IEF373I' then
do
parse var JOBMSGS.b . . . bdate '.' btime .
bdate = left(bdate,4)'.'right(bdate,3)
btime = left(btime,2)':'right(btime,2)
iterate
end
if msgid = 'IEF032I' then
do
parse var JOBMSGS.b . . . edate '.' etime .
edate = left(strip(edate),4)'.'right(edate,3)
etime = left(etime,2)':'right(etime,2)
leave i
end
end /*do b=l+1 to JOBMSGS.0*/
end

//Lasse

-----Ursprungligt meddelande-----
Från: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] För Robert Zenuk
Skickat: den 18 juni 2014 16:18
Till: TSO-***@VM.MARIST.EDU
Ämne: Re: [TSO-REXX] How to get Return Code for previous Step

I do not see that line in my personal copy, my sent folder copy or the copy
reply 'd by Lizette...

The say line from the first version sent (where I do see the error in the first
forward below) should be:

say jobname jobnum stepname 'RC='steprc

It looks to me like a listserv problem since the next 2 lines are:

say
call isfcalls 'OFF'

Rob


-----Original Message-----
From: John P Kalinich <***@CSC.COM<mailto:***@CSC.COM>>
To: TSO-REXX <TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>>
Sent: Wed, Jun 18, 2014 6:05 am
Subject: Re: How to get Return Code for previous Step


Why is the "say call isfcalls 'OFF'" included on the following line?
> say jobname jobnum stepname 'RC='steprc say call isfcalls 'OFF'
Regards,
ohn K
TSO REXX Discussion List <TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>>
wrote on 06/18/2014
7:34:52 AM:
> From: Lizette Koehler <***@MINDSPRING.COM<mailto:***@MINDSPRING.COM>>
To: TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>
Date: 06/18/2014 07:35 AM
Subject: Re: [TSO-REXX] How to get Return Code for previous Step Sent by: TSO
REXX Discussion List <TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>>

Thanks everyone.

All of these examples are going into my code folder for future reference.

And thanks Robert for the extra efforts on my behalf.

Lizette


> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On > Behalf
Of Robert Zenuk > Sent: Tuesday, June 17, 2014 5:54 PM > To:
TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU> > Subject: Re: [TSO-REXX]
How to get Return Code for previous Step > > An update. Some streamlining and
I noticed Lizette wanted the step ate and time > also...
>
> /*********************************************************************/
> /* REXX */
> /*********************************************************************/
> /* Purpose: Retrieve the return code from a specific step */
> /*-------------------------------------------------------------------*/
> /* Syntax: RCSTEP stepname */
> /*-------------------------------------------------------------------*/
> /* Parms: STEPNAME - Step name to get RC */
> /* */
> /*********************************************************************/
> /* Change Log */
> /* */
> /* Author Date Reason */
> /* -------- --------- ----------------------------------------- */
> /* R. Zenuk Jun 2014 Initial Creation */
> /* */
> /*********************************************************************/
> /* Accept stepname */
> /*********************************************************************/
> arg stepname .
> EXITRC = 0
> jobname = mvsvar('SYMDEF','JOBNAME') > /*********************************************************************/
> /* Invoke SDSF DA */
> /*********************************************************************/
> if isfcalls('ON') <> 0 then exit 99
> address SDSF "ISFEXEC DA"
> /*********************************************************************/
> /* Find the current jobname */
> /*********************************************************************/
> do i=1 to isfrows
> if jname.i = jobname then
> do
> jobnum = jobid.i
> /*********************************************************************/
> /* Select the jobname and allocate all the output sysout datasets */
> /*********************************************************************/
> address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
> /*********************************************************************/
> /* Read the JESYSMSG output */
> /*********************************************************************/
> address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
> /*********************************************************************/
> /* Parse out the STEP and RC (IEF142I) */
> /*********************************************************************/
> do l=1 to jobmsgs.0
> parse var jobmsgs.l msgid . step . . . . . . . steprc .
> if msgid <> 'IEF142I' then
> do
> iterate
> end
> else
> if step = stepname then
> do
> steprc = strip(steprc,'L',0)
> /*********************************************************************/
> /* Back up and grab the begin (IEF373I) and end time (IEF032I) */
> /*********************************************************************/
> b = l - 8
> parse var jobmsgs.b . . . bdate '.' btime .
> bdate = left(bdate,4)'.'right(bdate,3)
> btime = left(btime,2)':'right(btime,2)
> e = l - 7
> parse var jobmsgs.e . . . edate '.' etime .
> edate = left(strip(edate),4)'.'right(edate,3)
> etime = left(etime,2)':'right(etime,2)
> leave i
> end
> end
> leave i
> end
> end
> /*********************************************************************/
> /* Print step details */
> /*********************************************************************/
> say jobname jobnum stepname 'RC='steprc bdate btime '-' edate etime xit >
EXITRC > > Rob > > > -----Original Message----- > From: robzenuk
<***@aol.com<mailto:***@aol.com>> > To: TSO-REXX <TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>>
> Sent: Tue, Jun 17, 2014 11:06 am > Subject: Re: How to get Return Code for
previous Step > > > Here is a program called RCSTEP. It takes the desired
STEPNAME as a arm and > returns the current jobname, jobnumber, stepname and
stepRC. It pulls he IEF142I > message from JESYSMSG using SDSF/REXX.
>
> /*********************************************************************/
> /* REXX */
> /*********************************************************************/
> /* Purpose: Retrieve the return code from a specific step */
> /*-------------------------------------------------------------------*/
> /* Syntax: RCSTEP stepname */
> /*-------------------------------------------------------------------*/
> /* Parms: STEPNAME - Step name to get RC */
> /* */
> /*********************************************************************/
> /* Change Log */
> /* */
> /* Author Date Reason */
> /* -------- --------- ----------------------------------------- */
> /* R. Zenuk Jun 2014 Initial Creation */
> /* */
> /*********************************************************************/
> /* Accept stepname */
> /*********************************************************************/
> arg stepname .
> /*********************************************************************/
> /* Set Exit Code, the number of bad steps and the current jobname */
> /*********************************************************************/
> EXITRC = 0
> jobname = mvsvar('SYMDEF','JOBNAME') > /*********************************************************************/
> /* Invoke SDSF DA */
> /*********************************************************************/
> if isfcalls('ON') <> 0 then exit 99
> address SDSF "ISFEXEC DA"
> call isferror 'ISFEXEC'
> /*********************************************************************/
> /* Find the current jobname */
> /*********************************************************************/
> do i=1 to isfrows
> if jname.i = jobname then
> do
> jobnum = jobid.i
> /*********************************************************************/
> /* Select the jobname and allocate all the output sysout datasets */
> /*********************************************************************/
> address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
> call isferror 'ISFACT'
> /*********************************************************************/
> /* Read the JESYSMSG output */
> /*********************************************************************/
> address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
> /*********************************************************************/
> /* Parse out the STEP and RC */
> /*********************************************************************/
> do l=1 to jobmsgs.0
> parse var jobmsgs.l msgid . step . . . . . . . steprc .
> if msgid <> 'IEF142I' then
> iterate
> else
> if step = stepname then
> leave
> end
> end
> end
> /*********************************************************************/
> /* Summarize the bad steps */
> /*********************************************************************/
> say
> say jobname jobnum stepname 'RC='steprc say call isfcalls 'OFF'
> exit EXITRC
> /*********************************************************************/
> /* SDSF error conditions */
> /*********************************************************************/
> isferror: arg sdfscall
> select
> /*********************************************************************/
> /* Ignorable conditions */
> /*********************************************************************/
> when isfmsg = '' then return
> when isfmsg = 'DATA SET ALLOCATED' then return
> /*********************************************************************/
> /* Real errors - always RC=16 */
> /*********************************************************************/
> otherwise
> do
> say isfmsg
> say
> do e=1 to isfmsg2.0
> say sdsfcall right(e,2)':' isfmsg2.e
> end
> exit 16
> end
> end
>
> Some test JCL:
>
> //jobcard
> //***************************************************************
> //* SDSF/REXX TO ISSUE COMMANDS IN BATCH *
> //***************************************************************
> //STEP1 EXEC PGM=IKJEFT01,PARM='SETRC 5'
> //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> //SYSTSPRT DD SYSOUT=*
> //SYSTSIN DD DUMMY
> //STEP2 EXEC PGM=IEFBR14
> //STEP3 EXEC PGM=IEFBR14
> //STEP4 EXEC PGM=IEFBR14
> //STEP5 EXEC PGM=IKJEFT01,PARM='SETRC 88'
> //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> //SYSTSPRT DD SYSOUT=*
> //SYSTSIN DD DUMMY
> //STEP6 EXEC PGM=IEFBR14
> //STEP7 EXEC PGM=IEFBR14
> //STEP8 EXEC PGM=IEFBR14
> //STEP9 EXEC PGM=IEFBR14
> //RCSTEP EXEC PGM=IKJEFT01,PARM='RCSTEP STEP5'
> //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> //SYSTSPRT DD SYSOUT=*
> //SYSTSIN DD DUMMY
> //STEP10 EXEC PGM=IEFBR14
>
> The SETRC EXEC is as follows
>
> /* rexx */
> exit arg(1)
>
>
> Rob
>
> -----Original Message-----
> From: Lizette Koehler <***@MINDSPRING.COM<mailto:***@MINDSPRING.COM>>
> To: TSO-REXX <TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>> > Sent:
Tue, Jun 17, 2014 6:10 am > Subject: How to get Return Code for previous Step
> > > I was going to search the archives, until I saw it would not be that
asy.
>
> I hope the Listserver gets upgraded for TSO-REXX so it is easier to search.
>
> My question.
>
> I am running a two-step job where I want to capture the info from step ne nd
use it > to create a log file as the second step that will provide the ollowing
> > JOBNAME, JOBNUMBER, Return Code, Date and Time > > I have seen the
snippets in the past where others have done this in EXX.
>
> If some kind soul could send that again, I would be grateful.
>
> Thanks
>
> Lizette
----------------------------------------------------------------------
or TSO-REXX subscribe / signoff / archive access instructions, end email to
***@VM.MARIST.EDU<mailto:***@VM.MARIST.EDU> with the message: INFO
TSO-REXX


----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions, send email to
***@VM.MARIST.EDU<mailto:***@VM.MARIST.EDU> with the message: INFO
TSO-REXX


----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX




----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
DTCC DISCLAIMER: This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error, please notify us immediately and delete the email and any attachments from your system. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
Robert Zenuk
2014-06-19 15:23:10 UTC
Permalink
Excellent question/suggestion!


ISFPREFIX=jobname


This would be a good enhancement since it would avoid reviewing all running tasks in the ISFROWS loop. While it already runs very fast and I leave when I find it, why waste the loops... We do not allow duplicate jobnames to run concurrently in our shop, so this would work for us since the job will be running if this EXEC is in a IKJEFT01 step and has control... In my defense, I pulled some old code to start with that was reviewing joblogs from multiple STC's with the same name... In that case, to get all LPAR's in the plex, I also set


ISFSYSNAME='*'


As far as each STC's finding its own active task in SDSF from a REXX step, I tend to start from my active TCB and work backwards to the jobname and jobnum to confirm that.. This chunk of code allows you to provide the jobname and job number as filters to SDSF...



/* rexx - JOBID */
tcb = storage(21c,4)
jscb = storage(d2x(c2d(tcb)+180),4)
ssib = storage(d2x(c2d(jscb)+316),4)
jobnum = storage(d2x(c2d(ssib)+12),8)
say mvsvar('SYMDEF',JOBNAME) jobnum



Here is the new code with your enhancement: Sometimes I put new code out there too fast... The iterative development by email is fun though... On a slow day... Is it too early for a cold one?



/*********************************************************************/
/* REXX */
/*********************************************************************/
/* Purpose: Retrieve the return code from a specific step */
/*-------------------------------------------------------------------*/
/* Syntax: RCSTEP stepname */
/*-------------------------------------------------------------------*/
/* Parms: STEPNAME - Step name to get RC */
/* */
/*********************************************************************/
/* Change Log */
/* */
/* Author Date Reason */
/* -------- --------- ----------------------------------------- */
/* R. Zenuk Jun 2014 Initial Creation */
/* L. Hoglund 06/19/14 Fixed to find CORRECT IEF373I and IEF032I */
/* H. Sokolsky 06/19/14 Performance improvement ISFPREFIX=jobname */
/* */
/*********************************************************************/
/* Accept stepname */
/*********************************************************************/
arg stepname .
EXITRC = 0
isfprefix = mvsvar('SYMDEF','JOBNAME')
/*********************************************************************/
/* Invoke SDSF DA */
/*********************************************************************/
if isfcalls('ON') <> 0 then exit 99
address SDSF "ISFEXEC DA"
/*********************************************************************/
/* Find the current jobname */
/*********************************************************************/
do i=1 to isfrows
if jname.i = isfprefix then
do
jobnum = jobid.i
/*********************************************************************/
/* Select the jobname and allocate all the output sysout datasets */
/*********************************************************************/
address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
/*********************************************************************/
/* Read the JESYSMSG output */
/*********************************************************************/
address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
/*********************************************************************/
/* Parse out the STEP and RC (IEF142I) */
/*********************************************************************/
do l=1 to jobmsgs.0
parse var jobmsgs.l msgid . step . . . . . . . steprc .
if msgid <> 'IEF142I' then
do
iterate
end
else
if step = stepname then
do
steprc = strip(steprc,'L',0)
/*********************************************************************/
/* Back up and grab the begin (IEF373I) and end time (IEF032I) */
/*********************************************************************/
do b=l+1 to jobmsgs.0
parse var jobmsgs.b msgid .
if msgid = 'IEF373I' then
do
parse var jobmsgs.b . . . bdate '.' btime .
bdate = left(bdate,4)'.'right(bdate,3)
btime = left(btime,2)':'right(btime,2)
end
if msgid = 'IEF032I' then
do
parse var jobmsgs.b . . . edate '.' etime .
edate = left(strip(edate),4)'.'right(edate,3)
etime = left(etime,2)':'right(etime,2)
leave i
end
end
end
end
leave i
end
end
/*********************************************************************/
/* Print step details */
/*********************************************************************/
say isfprefix jobnum stepname 'RC='steprc bdate btime '-' edate etime
exit EXITRC


Rob


-----Original Message-----
From: Sokolsky, Hayim Z. <***@DTCC.COM>
To: TSO-REXX <TSO-***@VM.MARIST.EDU>
Sent: Thu, Jun 19, 2014 7:54 am
Subject: Re: How to get Return Code for previous Step


I've got some questions ....

1. Why not use
isfprefix= jobname
prior to
address SDSF "ISFEXEC DA"

This limits the output of the ISFEXEC DA to only jobs that match your jobname.

2. How do you know this is "you"? In asking the question I realized that almost
all installations disallow duplication job names, therefore ISFEXEC DA is fine.
But if you are using this in a started task, the question still remains. There
is no lookup on job number.

I have not coded up a solution. Nonetheless, it should be simple enough to check
the ASID of the active task, versus the ISFEXEC DA output to provide this match.

Hayim Sokolsky
Manager, Mainframe Security Architecture
Technology Risk Management
DTCC Tampa
Direct: +1 813 470-2177 | ***@dtcc.com



Visit us at www.dtcc.com or follow us on Twitter @The_DTCC and on LinkedIn.
To learn about career opportunities at DTCC, please visit dtcc.com/careers.

Classification: DTCC Non-Confidential (WHITE)

The views I have expressed in this email are my own personal views, and are not
endorsed or supported by, and do not necessarily express or reflect, the views,
positions or strategies of my employer.



-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On Behalf Of
Robert Zenuk
Sent: Thursday, June 19, 2014 10:00
To: TSO-***@VM.MARIST.EDU
Subject: Re: [TSO-REXX] SV: [TSO-REXX] How to get Return Code for previous Step

DOH! You're right. We have some z/OS 2.1 test systems. And... This is true
on our z/OS 1.13 production systems also. Sorry for the confusion the IEF373I
and IEF032I messages DO follow the IEF142I message in the 2 cases I have
visibility too... Thanks Lars!


Here is the updated code:



/*********************************************************************/
/* REXX */
/*********************************************************************/
/* Purpose: Retrieve the return code from a specific step */
/*-------------------------------------------------------------------*/
/* Syntax: RCSTEP stepname */
/*-------------------------------------------------------------------*/
/* Parms: STEPNAME - Step name to get RC */
/* */
/*********************************************************************/
/* Change Log */
/* */
/* Author Date Reason */
/* -------- --------- ----------------------------------------- */
/* R. Zenuk Jun 2014 Initial Creation */
/* L. Hoglund 06/19/14 Fixed to find CORRECT IEF373I and IEF032I */
/* */
/*********************************************************************/
/* Accept stepname */
/*********************************************************************/
arg stepname .
EXITRC = 0
jobname = mvsvar('SYMDEF','JOBNAME')
/*********************************************************************/
/* Invoke SDSF DA */
/*********************************************************************/
if isfcalls('ON') <> 0 then exit 99
address SDSF "ISFEXEC DA"
/*********************************************************************/
/* Find the current jobname */
/*********************************************************************/
do i=1 to isfrows
if jname.i = jobname then
do
jobnum = jobid.i
/*********************************************************************/
/* Select the jobname and allocate all the output sysout datasets */
/*********************************************************************/
address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
/*********************************************************************/
/* Read the JESYSMSG output */
/*********************************************************************/
address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
/*********************************************************************/
/* Parse out the STEP and RC (IEF142I) */
/*********************************************************************/
do l=1 to jobmsgs.0
parse var jobmsgs.l msgid . step . . . . . . . steprc .
if msgid <> 'IEF142I' then
do
iterate
end
else
if step = stepname then
do
steprc = strip(steprc,'L',0)
/*********************************************************************/
/* Back up and grab the begin (IEF373I) and end time (IEF032I) */
/*********************************************************************/
do b=l+1 to jobmsgs.0
parse var jobmsgs.b msgid .
if msgid = 'IEF373I' then
do
parse var jobmsgs.b . . . bdate '.' btime .
bdate = left(bdate,4)'.'right(bdate,3)
btime = left(btime,2)':'right(btime,2)
end
if msgid = 'IEF032I' then
do
parse var jobmsgs.b . . . edate '.' etime .
edate = left(strip(edate),4)'.'right(edate,3)
etime = left(etime,2)':'right(etime,2)
leave i
end
end
end
end
leave i
end
end
/*********************************************************************/
/* Print step details */
/*********************************************************************/
say jobname jobnum stepname 'RC='steprc bdate btime '-' edate etime
exit EXITRC





Rob



-----Original Message-----
From: Höglund Lars <***@ALECTA.SE>
To: TSO-REXX <TSO-***@VM.MARIST.EDU>
Sent: Thu, Jun 19, 2014 5:32 am
Subject: SV: [TSO-REXX] How to get Return Code for previous Step


Running z/OS 2.1 and then we are going forward to fetch Start and End time

Like:

if msgid <> 'IEF142I' then
iterate
else
/* we found the message... */
if step = stepname then
do
/* ...for the searched step */
steprc = strip(steprc,'L',0)
/***************************************************/
/* go on and grab the begin (IEF373I) */
/* and end time (IEF032I) */
/* */
/* IEF373I STEP/STEP4 /START 2014170.1400 */
/* IEF032I STEP/STEP4 /STOP 2014170.1400 */
/* CPU: 0 HR 00 MIN 00.00 -> below same row */
/* SEC SRB: 0 HR 00 MIN 00.00 SEC */
/***************************************************/
do b=l+1 to JOBMSGS.0
parse var JOBMSGS.b msgid .
if msgid = 'IEF373I' then
do
parse var JOBMSGS.b . . . bdate '.' btime .
bdate = left(bdate,4)'.'right(bdate,3)
btime = left(btime,2)':'right(btime,2)
iterate
end
if msgid = 'IEF032I' then
do
parse var JOBMSGS.b . . . edate '.' etime .
edate = left(strip(edate),4)'.'right(edate,3)
etime = left(etime,2)':'right(etime,2)
leave i
end
end /*do b=l+1 to JOBMSGS.0*/
end

//Lasse

-----Ursprungligt meddelande-----
Från: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] För Robert Zenuk
Skickat: den 18 juni 2014 16:18
Till: TSO-***@VM.MARIST.EDU
Ämne: Re: [TSO-REXX] How to get Return Code for previous Step

I do not see that line in my personal copy, my sent folder copy or the copy
reply 'd by Lizette...

The say line from the first version sent (where I do see the error in the first
forward below) should be:

say jobname jobnum stepname 'RC='steprc

It looks to me like a listserv problem since the next 2 lines are:

say
call isfcalls 'OFF'

Rob


-----Original Message-----
From: John P Kalinich <***@CSC.COM<mailto:***@CSC.COM>>
To: TSO-REXX <TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>>
Sent: Wed, Jun 18, 2014 6:05 am
Subject: Re: How to get Return Code for previous Step


Why is the "say call isfcalls 'OFF'" included on the following line?
> say jobname jobnum stepname 'RC='steprc say call isfcalls 'OFF'
Regards,
ohn K
TSO REXX Discussion List <TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>>

wrote on 06/18/2014
7:34:52 AM:
> From: Lizette Koehler <***@MINDSPRING.COM<mailto:***@MINDSPRING.COM>>
To: TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>
Date: 06/18/2014 07:35 AM
Subject: Re: [TSO-REXX] How to get Return Code for previous Step Sent by: TSO
REXX Discussion List <TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>>

Thanks everyone.

All of these examples are going into my code folder for future reference.

And thanks Robert for the extra efforts on my behalf.

Lizette


> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On > Behalf
Of Robert Zenuk > Sent: Tuesday, June 17, 2014 5:54 PM > To:
TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU> > Subject: Re: [TSO-REXX]

How to get Return Code for previous Step > > An update. Some streamlining and

I noticed Lizette wanted the step ate and time > also...
>
> /*********************************************************************/
> /* REXX */
> /*********************************************************************/
> /* Purpose: Retrieve the return code from a specific step */
> /*-------------------------------------------------------------------*/
> /* Syntax: RCSTEP stepname */
> /*-------------------------------------------------------------------*/
> /* Parms: STEPNAME - Step name to get RC */
> /* */
> /*********************************************************************/
> /* Change Log */
> /* */
> /* Author Date Reason */
> /* -------- --------- ----------------------------------------- */
> /* R. Zenuk Jun 2014 Initial Creation */
> /* */
> /*********************************************************************/
> /* Accept stepname */
> /*********************************************************************/
> arg stepname .
> EXITRC = 0
> jobname = mvsvar('SYMDEF','JOBNAME') > /*********************************************************************/
> /* Invoke SDSF DA */
> /*********************************************************************/
> if isfcalls('ON') <> 0 then exit 99
> address SDSF "ISFEXEC DA"
> /*********************************************************************/
> /* Find the current jobname */
> /*********************************************************************/
> do i=1 to isfrows
> if jname.i = jobname then
> do
> jobnum = jobid.i
> /*********************************************************************/
> /* Select the jobname and allocate all the output sysout datasets */
> /*********************************************************************/
> address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
> /*********************************************************************/
> /* Read the JESYSMSG output */
> /*********************************************************************/
> address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
> /*********************************************************************/
> /* Parse out the STEP and RC (IEF142I) */
> /*********************************************************************/
> do l=1 to jobmsgs.0
> parse var jobmsgs.l msgid . step . . . . . . . steprc .
> if msgid <> 'IEF142I' then
> do
> iterate
> end
> else
> if step = stepname then
> do
> steprc = strip(steprc,'L',0)
> /*********************************************************************/
> /* Back up and grab the begin (IEF373I) and end time (IEF032I) */
> /*********************************************************************/
> b = l - 8
> parse var jobmsgs.b . . . bdate '.' btime .
> bdate = left(bdate,4)'.'right(bdate,3)
> btime = left(btime,2)':'right(btime,2)
> e = l - 7
> parse var jobmsgs.e . . . edate '.' etime .
> edate = left(strip(edate),4)'.'right(edate,3)
> etime = left(etime,2)':'right(etime,2)
> leave i
> end
> end
> leave i
> end
> end
> /*********************************************************************/
> /* Print step details */
> /*********************************************************************/
> say jobname jobnum stepname 'RC='steprc bdate btime '-' edate etime xit >
EXITRC > > Rob > > > -----Original Message----- > From: robzenuk
<***@aol.com<mailto:***@aol.com>> > To: TSO-REXX <TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>>

> Sent: Tue, Jun 17, 2014 11:06 am > Subject: Re: How to get Return Code for
previous Step > > > Here is a program called RCSTEP. It takes the desired
STEPNAME as a arm and > returns the current jobname, jobnumber, stepname and
stepRC. It pulls he IEF142I > message from JESYSMSG using SDSF/REXX.
>
> /*********************************************************************/
> /* REXX */
> /*********************************************************************/
> /* Purpose: Retrieve the return code from a specific step */
> /*-------------------------------------------------------------------*/
> /* Syntax: RCSTEP stepname */
> /*-------------------------------------------------------------------*/
> /* Parms: STEPNAME - Step name to get RC */
> /* */
> /*********************************************************************/
> /* Change Log */
> /* */
> /* Author Date Reason */
> /* -------- --------- ----------------------------------------- */
> /* R. Zenuk Jun 2014 Initial Creation */
> /* */
> /*********************************************************************/
> /* Accept stepname */
> /*********************************************************************/
> arg stepname .
> /*********************************************************************/
> /* Set Exit Code, the number of bad steps and the current jobname */
> /*********************************************************************/
> EXITRC = 0
> jobname = mvsvar('SYMDEF','JOBNAME') > /*********************************************************************/
> /* Invoke SDSF DA */
> /*********************************************************************/
> if isfcalls('ON') <> 0 then exit 99
> address SDSF "ISFEXEC DA"
> call isferror 'ISFEXEC'
> /*********************************************************************/
> /* Find the current jobname */
> /*********************************************************************/
> do i=1 to isfrows
> if jname.i = jobname then
> do
> jobnum = jobid.i
> /*********************************************************************/
> /* Select the jobname and allocate all the output sysout datasets */
> /*********************************************************************/
> address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
> call isferror 'ISFACT'
> /*********************************************************************/
> /* Read the JESYSMSG output */
> /*********************************************************************/
> address TSO "EXECIO * DISKR" isfddname.3 "(STEM JOBMSGS. FINIS"
> /*********************************************************************/
> /* Parse out the STEP and RC */
> /*********************************************************************/
> do l=1 to jobmsgs.0
> parse var jobmsgs.l msgid . step . . . . . . . steprc .
> if msgid <> 'IEF142I' then
> iterate
> else
> if step = stepname then
> leave
> end
> end
> end
> /*********************************************************************/
> /* Summarize the bad steps */
> /*********************************************************************/
> say
> say jobname jobnum stepname 'RC='steprc say call isfcalls 'OFF'
> exit EXITRC
> /*********************************************************************/
> /* SDSF error conditions */
> /*********************************************************************/
> isferror: arg sdfscall
> select
> /*********************************************************************/
> /* Ignorable conditions */
> /*********************************************************************/
> when isfmsg = '' then return
> when isfmsg = 'DATA SET ALLOCATED' then return
> /*********************************************************************/
> /* Real errors - always RC=16 */
> /*********************************************************************/
> otherwise
> do
> say isfmsg
> say
> do e=1 to isfmsg2.0
> say sdsfcall right(e,2)':' isfmsg2.e
> end
> exit 16
> end
> end
>
> Some test JCL:
>
> //jobcard
> //***************************************************************
> //* SDSF/REXX TO ISSUE COMMANDS IN BATCH *
> //***************************************************************
> //STEP1 EXEC PGM=IKJEFT01,PARM='SETRC 5'
> //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> //SYSTSPRT DD SYSOUT=*
> //SYSTSIN DD DUMMY
> //STEP2 EXEC PGM=IEFBR14
> //STEP3 EXEC PGM=IEFBR14
> //STEP4 EXEC PGM=IEFBR14
> //STEP5 EXEC PGM=IKJEFT01,PARM='SETRC 88'
> //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> //SYSTSPRT DD SYSOUT=*
> //SYSTSIN DD DUMMY
> //STEP6 EXEC PGM=IEFBR14
> //STEP7 EXEC PGM=IEFBR14
> //STEP8 EXEC PGM=IEFBR14
> //STEP9 EXEC PGM=IEFBR14
> //RCSTEP EXEC PGM=IKJEFT01,PARM='RCSTEP STEP5'
> //SYSEXEC DD DSN=OPSROZ.EXEC,DISP=SHR
> //SYSTSPRT DD SYSOUT=*
> //SYSTSIN DD DUMMY
> //STEP10 EXEC PGM=IEFBR14
>
> The SETRC EXEC is as follows
>
> /* rexx */
> exit arg(1)
>
>
> Rob
>
> -----Original Message-----
> From: Lizette Koehler <***@MINDSPRING.COM<mailto:***@MINDSPRING.COM>>

> To: TSO-REXX <TSO-***@VM.MARIST.EDU<mailto:TSO-***@VM.MARIST.EDU>> > Sent:
Tue, Jun 17, 2014 6:10 am > Subject: How to get Return Code for previous Step
> > > I was going to search the archives, until I saw it would not be that
asy.
>
> I hope the Listserver gets upgraded for TSO-REXX so it is easier to search.
>
> My question.
>
> I am running a two-step job where I want to capture the info from step ne nd

use it > to create a log file as the second step that will provide the ollowing

> > JOBNAME, JOBNUMBER, Return Code, Date and Time > > I have seen the
snippets in the past where others have done this in EXX.
>
> If some kind soul could send that again, I would be grateful.
>
> Thanks
>
> Lizette
----------------------------------------------------------------------
or TSO-REXX subscribe / signoff / archive access instructions, end email to
***@VM.MARIST.EDU<mailto:***@VM.MARIST.EDU> with the message: INFO
TSO-REXX


----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions, send email to
***@VM.MARIST.EDU<mailto:***@VM.MARIST.EDU> with the message: INFO
TSO-REXX


----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX




----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
DTCC DISCLAIMER: This email and any files transmitted with it are confidential
and intended solely for the use of the individual or entity to whom they are
addressed. If you have received this email in error, please notify us
immediately and delete the email and any attachments from your system. The
recipient should check this email and any attachments for the presence of
viruses. The company accepts no liability for any damage caused by any virus
transmitted by this email.




----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Continue reading on narkive:
Loading...