Page 1 of 1

return code of JCL

PostPosted: Mon Mar 07, 2011 2:58 pm
by syamcs
hi all,
I have a small doubt, is it possible to capture the return code of a JCl using rexx.

Re: return code of JCL

PostPosted: Mon Mar 07, 2011 4:02 pm
by Akatsukami
Yes, but why would you need to? JCL has pretty decent return code/abend/execution facilities itself.

Re: return code of JCL

PostPosted: Mon Mar 07, 2011 4:28 pm
by syamcs
Just want to know it. Can i knw how to capture it :) just give me a hint

Re: return code of JCL

PostPosted: Mon Mar 07, 2011 6:48 pm
by MrSpock
/* 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 */ 
/* 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                                                                 

Please note that this code is from public-domain freeware, so I take no credit for the content.

Re: return code of JCL

PostPosted: Tue Mar 08, 2011 4:08 pm
by syamcs
thanks Mr.spocks.... but wat is the input to this rexx code.... or how it can be executed?

Re: return code of JCL

PostPosted: Tue Mar 08, 2011 4:41 pm
by MrSpock
It would normally be run as the last step of a job, so it can capture the return-codes of all of the previous steps,

Re: return code of JCL

PostPosted: Tue Mar 08, 2011 5:04 pm
by syamcs
thanks MrSpock

Re: return code of JCL

PostPosted: Tue Mar 08, 2011 5:04 pm
by enrico-sorichetti
you were already answered here
clist-rexx/topic5369.html

Re: return code of JCL

PostPosted: Wed Oct 26, 2011 7:37 pm
by Marteria
Thanks for that link!!A lot of people will be benefited from your writing. Cheers!