View previous topic :: View next topic
|
Author |
Message |
Suresh Shankarakrishnan
New User
Joined: 11 Jul 2008 Posts: 42 Location: USA
|
|
|
|
The requirement is listed below-
1. One COBOL program - PRG1
2. One JCL - JCL1. This JCL runs the program PRG1 twice - in two different steps. Each run of the same program executes different code.
Example-
STEP10 'executes PRG1'
STEP20 'executes PRG1'
PRG1 has two PARA'S - PARA1 and PARA2. When program runs under STEP10,
code under PARA1 is run, under STEP20, code under PARA2 is run based on condition code returned from STEP10.
This can be done easily using two different programs, but wondering if the condition code returned in STEP10 can be passed into the program. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
No it can't. You'll have to look into reading and interpreting the JSCB control blocks from STEP10.
Wouldn't it be easier to just have PRG1 in STEP10 write it's final RETURN-CODE value into a dataset so it can then read that in STEP20? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
You could use a JCL parameter to pass into the COBOL program to indicate which execution path to take. I don't believe the step condition code can be directly passed to the COBOL code, though. You could use condition checking in your JCL to execute different steps with different parameters based on the first step's condition code -- as long as there's not a large number of possible condition codes. |
|
Back to top |
|
|
Suresh Shankarakrishnan
New User
Joined: 11 Jul 2008 Posts: 42 Location: USA
|
|
|
|
Thanks Robert and superk.
Of course, one way could be to write different values in a dataset after the program executes each time, and control the logic in the program based on that.
Or, another option could be to control the logic when the program runs a second time based on condition code and parm value..somethuing like this.
STEP10 'executes PRG1'
STEP20 IF cond code from STEP10 = 0
'execute PRG1 parm='xxx''
As an aside, did not know that COBOL could handle full classes, objects etc. like JAVA programs. |
|
Back to top |
|
|
ridgewalker58
New User
Joined: 26 Sep 2008 Posts: 51 Location: New York
|
|
|
|
Check the JCL manuals -- my computer is down now otherwise i would send you an example of the syntax
But in PSEUDO-JCL it looks somewhat like this
//run1 if (rc.stepname=04) then
//step01 exec pgm=yourpgmname
// end-if |
|
Back to top |
|
|
|