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
 

 

How to pass the return code from JCL to COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: How to pass the return code from JCL to COBOL
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: 680
Location: NJ

PostPosted: Wed Nov 23, 2005 12:05 pm    Post subject: Return code to cobol
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Job failing with USER = 4093 REASON C... Pradeepa S ABENDS & Debugging 1 Wed May 17, 2017 3:35 pm
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm


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