IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to pass the return code from JCL to COBOL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rameshchandra

New User


Joined: 23 Nov 2005
Posts: 6
Location: pune

PostPosted: Wed Nov 23, 2005 11:50 am
Reply with quote

Hi this is rameshchandra..i want to know the answers for these quetions..

1) How to pass the return code from JCL to COBOL?

2) How to write the return-code into a file in JCL?



Please give me reply immediately if anybody knows answer for any question?.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Wed Nov 23, 2005 12:05 pm
Reply with quote

hi frnd,
v should put the returncode in the file from the spool area only. use XDC in the spool area to send it in to the file. else check in the forum. then after u need to read it from the file using the cobol coding. i dont think there is any other way. let me search again. if any solution let me know.
Back to top
View user's profile Send private message
Phantom

New User


Joined: 04 Sep 2005
Posts: 25

PostPosted: Wed Nov 23, 2005 4:01 pm
Reply with quote

rameshchandra,

There is no direct way to pass a return code of a step to a COBOL program. But if you are good at Control Blocks (TCB - Task Control Block, JCB - Job Control Block) then you can retrieve the RC of any previous step (in the same job) by a COBOL / REXX program and process it.

This is a small REXX program which captures the RC of a given Step in the same job (Note: Your REXX program must also be in the same job. It can capture the RC of any steps prior to your REXX step).

Tailor this code to write the RC to a dataset and read the dataset using COBOL.
Code:

/* REXX                              */
/* 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


Hope this helps,

Thanks,
Phantom
Back to top
View user's profile Send private message
rameshchandra

New User


Joined: 23 Nov 2005
Posts: 6
Location: pune

PostPosted: Thu Nov 24, 2005 1:59 pm
Reply with quote

Hi phantom&khamaurutheen
thank u very much for u'r valuable response.
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts IBM IMU Utility for Easytrieve Code t... IBM Tools 0
No new posts Big Five Personality Test in COBOL - ... COBOL Programming 0
No new posts I wrote a Hallmark Movie Plot Generat... COBOL Programming 0
No new posts COBOL Text Adventure Engine for TK4- ... COBOL Programming 0
No new posts Cobcalc: An Algebraic Expression Eval... COBOL Programming 10
Search our Forums:


Back to Top