|
View previous topic :: View next topic
|
| Author |
Message |
rameshchandra
New User
Joined: 23 Nov 2005 Posts: 6 Location: pune
|
|
|
|
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 |
|
 |
khamarutheen
Active Member

Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
|
|
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 |
|
 |
Phantom
New User

Joined: 04 Sep 2005 Posts: 25
|
|
|
|
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 |
|
 |
rameshchandra
New User
Joined: 23 Nov 2005 Posts: 6 Location: pune
|
|
|
|
Hi phantom&khamaurutheen
thank u very much for u'r valuable response. |
|
| Back to top |
|
 |
|
|