View previous topic :: View next topic
|
Author |
Message |
Prabha Warnings : 2 New User
Joined: 05 Dec 2005 Posts: 79
|
|
|
|
Hi all,
If my program generates empty output file in jcl, then next step in that jcl should not run. For that how will you set the return code in program and how will you pass it thru JCL.
Step1 Exec Pgm=cobol1
Step2 exec Pgm=cobol2
If cobol1 produces empty output file, then step2 should not run.
Help me out this.. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
Back to top |
|
|
twissi
Active User
Joined: 01 Aug 2005 Posts: 105 Location: Somerset, NJ
|
|
|
|
Praba,
As Kevin suggested, it's been discussed earlier.
If you still need some explanation, here you go -
In COBOL1 program, add a step in the end to READ the output file you mentioned. If the number of records read is zero
Code: |
MOVE 4 TO RETURN-CODE ELSE MOVE 0 TO RETURN-CODE |
.
RETURN-CODE is a special register used to pass a return code from sub programs to main program and it has a definition of GLOBAL PIC S9(4) COMP VALUE 0.
In the JCL, you put a condition such that
Code: |
IF (STEP1.RC = 0)
give STEP2 lines
ENDIF |
nice and easy!
Cheers, Twissi |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Or possibly add a counter to the code and increment the counter each time you write a record. When the job is finished, you could compare the counter to zero and issue the return-code as suggested by Twissi. |
|
Back to top |
|
|
Prabha Warnings : 2 New User
Joined: 05 Dec 2005 Posts: 79
|
|
|
|
Many Thanks for all yr help !!!! |
|
Back to top |
|
|
|