Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Capture Abend code of the JCL step in REXX.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Vinodh S

New User


Joined: 12 Apr 2012
Posts: 30
Location: LA, California

PostPosted: Mon May 07, 2012 10:48 pm    Post subject: Capture Abend code of the JCL step in REXX.
Reply with quote

Hi..

I'm using the following REXX code to get the return codes of the previous steps in the JCL.

However the return code of a step is set to 0, though it had abened abnormally.

The JESMSGLG says the STEP0020B's RC as S04C, but the display statement gives the RC as 0.

Please let me know how to capture the Abended step .
I do not want the RC to be returned as 0, can it atleast be captured as a non zero RC.

Code:

/* REXX GETRC                        */                                 
/* GET THE STEP NAME AND RETURN CODE */                                 
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 */               
SAY 'FSCT 'FSCT   /* MY */                                             
SAY 'JCT  'JCT    /* MY */                                             
/* IS FIRST SCT */                                                     
TEMP_SCT = FSCT                                                         
DO I = 1 TO (THIS_STEP_NO - 1)                                         
  STEP = STORAGE(D2X(C2D(TEMP_SCT)+68),8)                               
  RCSTEP = X2D(C2X(STORAGE(D2X(C2D(TEMP_SCT)+24),2)))                   
  /* SCTSEXEC IN SCT */                                                 
  BYPASS = STORAGE(D2X(C2D(TEMP_SCT)+188),1)                           
  IF X2D(C2X(BYPASS)) = 80 THEN /* CHECK IF STEP WAS NOT EXECUTED */   
     DO                                                                 
       RCSTEP = 'FLUSHED '                                             
     END                                                               
   SAY 'STEP ==>' STEP ' RC ==>' RCSTEP                                 
   TEMP_SCT = STORAGE(D2X(C2D(TEMP_SCT)+36),3)                         
 END                                                                   
 EXIT                                                                   


Below is the JESMSGLG of the Job
Code:

-JOBNAME  STEPNAME PROCSTEP    RC   EXCP    CPU    SRB  CLOCK
-TESTSPRC          JS0010A     00     14    .00    .00    .00
-TESTSPRC          JS0010B     00    157    .00    .00    .00
-TESTSPRC          JS0015A     00     13    .00    .00    .00
-TESTSPRC          JS0015B     08    115    .00    .00    .00
-TESTSPRC          JS0020A     00     16    .00    .00    .00
-TESTSPRC          JS0020B  *S04C   2093    .01    .00    .06
-TESTSPRC          JS0025A     00     13    .00    .00    .00
-TESTSPRC          JS0025B  FLUSH      0    .00    .00    .00
-TESTSPRC          JS0035A     00     13    .00    .00    .00
-TESTSPRC          JS0035B  FLUSH      0    .00    .00    .00
-TESTSPRC          JS0040A     00     13    .00    .00    .00
-TESTSPRC          JS0040B  FLUSH      0    .00    .00    .00
-TESTSPRC          JS0045A     00     13    .00    .00    .00
-TESTSPRC          JS0045B  FLUSH      0    .00    .00    .00
-TESTSPRC          JS0050A     00     13    .00    .00    .00
-TESTSPRC          JS0050B  FLUSH      0    .00    .00    .00
-TESTSPRC          JS0055A     00     13    .00    .00    .00


The SYSTSPRT of the REXX program is as follows.
Code:

STEP ==> JS0010A   RC ==> 0       
STEP ==> JS0010B   RC ==> 0       
STEP ==> JS0015A   RC ==> 0       
STEP ==> JS0015B   RC ==> 8       
STEP ==> JS0020A   RC ==> 0       
STEP ==> JS0020B   RC ==> 0       
STEP ==> JS0025A   RC ==> 0       
STEP ==> JS0025B   RC ==> FLUSHED
STEP ==> JS0035A   RC ==> 0       
STEP ==> JS0035B   RC ==> FLUSHED
STEP ==> JS0040A   RC ==> 0       
STEP ==> JS0040B   RC ==> FLUSHED
STEP ==> JS0045A   RC ==> 0       
STEP ==> JS0045B   RC ==> FLUSHED
STEP ==> JS0050A   RC ==> 0       
STEP ==> JS0050B   RC ==> FLUSHED
STEP ==> JS0055A   RC ==> 0       
STEP ==> JS0055B   RC ==> FLUSHED
STEP ==> JS0060A   RC ==> 0       
STEP ==> JS0060B   RC ==> FLUSHED
Back to top
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Tue May 08, 2012 12:26 am    Post subject: Reply to: Capture Abend code of the JCL step in REXX.
Reply with quote

I've never seen a process in REXX (yet, anyway) to capture an abend of a step, since that usually causes the entire job to flush.

Maybe you need to consider getting this information by some other means?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue May 08, 2012 12:43 am    Post subject:
Reply with quote

Hello,

An abend is an Abend. There is not a return code associated with an abend (neither System nor User abends) . . .

You might look at the JCL condition code tests for EVEN and ONLY so that your rexx could run after an abend.

I may not completely understand also. . .
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Tue May 08, 2012 12:59 am    Post subject: Reply to: Capture Abend code of the JCL step in REXX.
Reply with quote

It looks like SCTXABCC is a suitable field. It is part of the SCTX. The SCT and SCTX mappings are described in "MVS Data Areas , Volume 5 (MCSOP-SPT)"
Back to top
View user's profile Send private message
parsesource

New User


Joined: 06 Feb 2006
Posts: 97

PostPosted: Tue May 08, 2012 2:18 am    Post subject: Reply to: Capture Abend code of the JCL step in REXX.
Reply with quote

the xmitip mailpackage

http://www.lbdsoftware.com/xmitip.html

uses a rexx-skript called condcode. compare your script with this one.
Back to top
View user's profile Send private message
jon_s_rice

Active User


Joined: 24 Mar 2005
Posts: 102
Location: Douglasville, GA USA

PostPosted: Tue May 08, 2012 6:56 am    Post subject: The following code catches abend codes
Reply with quote

Code:
/* 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 = "DUMP" then
        dump_opt = "Y"
    else
        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 dump_opt = "Y" then
        "dydump" storage(d2x(c2d(temp_sct)),512)
    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"
            if dump_opt = "Y" then
                "dydump" storage(d2x(c2d(sctx)),256)
            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
Back to top
View user's profile Send private message
Vinodh S

New User


Joined: 12 Apr 2012
Posts: 30
Location: LA, California

PostPosted: Wed May 09, 2012 5:21 pm    Post subject:
Reply with quote

Thanks everyone for the Reply.
The problem is that i do not know much about the data area that are referred in this program.


    @pedro.
    Thanks a lot for the Poniter, (MVS Data Areas , Volume 5 (MCSOP-SPT)) , this book was just awesome.
    But still i couldnt use the SCTXABCC field, since i dint how to get to that location of the Data Area.

    If you can help me on that it would be of great use.
    Thanks.

    @parsesource
    Your info was just necessary to help me find out the solution, Got the CONDCODE script and used it, Presto. It worked like i wanted . Used the same got my issue resolved. icon_smile.gif

    @jon_s_rice
    Thanks for investing time to send that code. Yet to execute them and test it. Will let you know.
    Back to top
    View user's profile Send private message
    Pedro

    Senior Member


    Joined: 01 Sep 2006
    Posts: 2019
    Location: Silicon Valley

    PostPosted: Wed May 09, 2012 7:00 pm    Post subject: Reply to: Capture Abend code of the JCL step in REXX.
    Reply with quote

    Quote:
    But still i couldnt use the SCTXABCC field, since i dint how to get to that location of the Data Area.


    The first part of the SCTX description mentions this:
    Quote:
    Pointed to by: SCTXBTTR field of the Step Control Table


    The map of the SCT includes the offset of the SCTXBTTR, and you already have the address of the SCT.
    Back to top
    View user's profile Send private message
    Eddie Sasser

    New User


    Joined: 10 Aug 2011
    Posts: 2
    Location: US

    PostPosted: Wed Jul 18, 2012 12:08 am    Post subject:
    Reply with quote

    You guys freakin rock!
    Back to top
    View user's profile Send private message
    View previous topic :: :: View next topic  
    Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
    Page 1 of 1

     

    Search our Forum:

    Similar Topics
    Topic Author Forum Replies Posted
    No new posts PL/I code tuning/Performance improvement Virendra Shambharkar PL/I & Assembler 4 Mon Dec 05, 2016 11:57 am
    No new posts What is the code in CLIST to enable t... jackzhang75 CLIST & REXX 1 Fri Dec 02, 2016 3:02 am
    No new posts IDEAL - Code Retrieval yugendran CA Products 0 Fri Nov 25, 2016 3:27 pm
    No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
    No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm


    Facebook
    Back to Top
     
    Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us