View previous topic :: View next topic |
Author |
Message |
Anand_R Intermediate
Joined: 24 Dec 2002 Posts: 189 Topics: 60
|
Posted: Tue Feb 24, 2004 10:08 am Post subject: Force the job return code based on step condition code. |
|
|
Hi,
I have requirement to force the job return code, based on the step return code. I have following job.
pstep01 EXEC pgm=prog1
pstep02 EXEC pgm= prog1
pstep03 EXEC pgm = prog1
Above steps will be executed for differnt input files with the same program. So it will throw the return code depends on the conditions. My requirment is I want to force the job return code, only when the pstep01 step return code is '99'. Is there any way that I can do that?
Please let me know
Thanks
Anand |
|
Back to top |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Tue Feb 24, 2004 10:21 am Post subject: |
|
|
Quote: | My requirment is I want to force the job return code, only when the pstep01 step return code is '99'. |
Meaning? You want to reset the return code to something else? Surely, you can modify the program to send the relevant code.
Or, when the return code is 99 from step1, you want/do not want the other steps to execute and yet pass some return code other than 99.
Can you please elaborate?
BTW, rather than having three steps have you considered this approach (with "logical EOF")?
Code: |
//STEP EXEC PGM=YOUR PROGRAM,
//IN01 DD DSN=YOUR.INPUT.FILE.NUMBER1,DISP=SHR
// DD *
EOF
/*
// DD DSN=YOUR.INPUT.FILE.NUMBER2,DISP=SHR
// DD *
EOF
/*
// DD DSN=YOUR.INPUT.FILE.NUMBER3,DISP=SHR
// DD *
EOF
/*
// |
Your program is now being supplied with all the three input files + three more records to "mark" EOF. Once you reach first EOF, you have various options:
[/list] _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes. |
|
Back to top |
|
|
Anand_R Intermediate
Joined: 24 Dec 2002 Posts: 189 Topics: 60
|
Posted: Tue Feb 24, 2004 10:28 am Post subject: |
|
|
Hi Cogito
Thanks for your response..
Actually at the end of the job, I want to check for particular step return code and force the job return code with other return code. So can it be done by any utility or by jcl.
Thanks
Anand |
|
Back to top |
|
|
mfjin Beginner
Joined: 26 Apr 2003 Posts: 94 Topics: 17
|
Posted: Tue Feb 24, 2004 10:39 am Post subject: |
|
|
Cant you use IDCAMS after each step to do the something like below
IF LASTCC = 99 SET MAXCC = 16 |
|
Back to top |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Tue Feb 24, 2004 10:46 am Post subject: |
|
|
Anand_R,
I am not aware about any utility that would reset the return code.
You might like to add a step towards the end that would be executed depending on the return code of a previous step. The COND paramter can be used here. This step must execute a COBOL (or PL/I, or REXX, or whatever) program that simply passess the desired number as the return code. If the new code that you want to force is less than 99 the MAXCC would be still 99. OTOH, if it is greater than 99 then, the MAXCC would be the higher one.
Assuming, the steps that you have posted are the only steps in your job then you can condense the steps as posted above. Then, you can force a return code whatever you want when you encounter the situation where you have to pass a return code of 99.
In case of extra step, you have advantage of "saving" the RC in JESMSGLG; while this will not be possible in case of three steps condensed to one. _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes. |
|
Back to top |
|
|
Anand_R Intermediate
Joined: 24 Dec 2002 Posts: 189 Topics: 60
|
Posted: Tue Feb 24, 2004 10:51 am Post subject: |
|
|
mfjin,
Can you explanin ,what it exactly does, as per my understanding, it will set the maximum condition of the job(until that step) to 16 if LASTCC=99 ?
Thanks
Anand |
|
Back to top |
|
|
mfjin Beginner
Joined: 26 Apr 2003 Posts: 94 Topics: 17
|
Posted: Tue Feb 24, 2004 11:13 am Post subject: |
|
|
Yes Anand youve got it right. What happens is it checks for the last return code issued and then changes it accordingly.
For instance I use the below to change return code from 8 to 0
//SDELETE EXEC PGM=IDCAMS
//SYSIN DD *
IF MAXCC = 8 THEN SET MAXCC = 0
//SYSPRINT DD SYSOUT=*
//SYSABEND DD SYSOUT=*
So you could something like this after each step of your job. |
|
Back to top |
|
|
Anand_R Intermediate
Joined: 24 Dec 2002 Posts: 189 Topics: 60
|
Posted: Tue Feb 24, 2004 11:42 am Post subject: |
|
|
mfjin & Cogito,
Thanks for all your help...
mfjin,
I cannot code that way, as the steps after pstep03 will dependent on previous steps condition codes.
Anyhow thanks for all your help
Anand |
|
Back to top |
|
|
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Tue Feb 24, 2004 11:07 pm Post subject: |
|
|
As far as I know there's no way to change the RCs issued by other steps in a job. IDCAMS can only change the RCs returned by the IDCAMS utility's execution in that step. It cannot change the RC of another step.
On 2nd thought some evil Systems Pgmr might, with some effort and only after entering the system state, accomplish the feat. But it would leave him scarred for life.
Regards, Jack. |
|
Back to top |
|
|
|
|