Page 1 of 1

Check return codes of all job steps usng IF statement

PostPosted: Thu Oct 15, 2015 1:39 am
by nkulkarni
Hi,

I want to run a step called STEPLST only when the return codes produced by the previous steps don't fall in 0, 98 & 99...

Tricky part is that this step will be added to many jobs at the end of their steps so I don't know how many steps are present in each job.
Due to this I can't use STEPNAME.RC in the IF statement of this JCL to conditionally execute the step as every job may has different number of steps.

Could anyone suggest if there is anyway where we can check the Return Codes produced by all the steps present in the job?

For example, If job A has 5 steps and B has 7 steps the condition should check return codes of all 5 steps in job A and 7 steps in Job B

Re: Check return codes of all job steps usng IF statement

PostPosted: Thu Oct 15, 2015 1:57 am
by prino
What's wrong with:

//MYCOND  IF RC ¬= 0 & RC ¬= 98 & RC ¬= 99 THEN
//    EXEC PGM=STEPLST
//MYCONDE ENDIF

And you cannot test for more than 8 conditions anyway.

Re: Check return codes of all job steps usng IF statement

PostPosted: Thu Oct 15, 2015 2:42 am
by nkulkarni
Hi Prino,

Thank you for the response.

I used the same condition but it is not working.

Looks like the reason is that JCL has 2 PROCs (Proc-A and Proc-B) and I need to check the Return codes produced by steps inside proc...

JCL:

//JOB-CARD
// JCLLIB ORDER=ABC.DF.GHI
//PROCA EXEC PROCA
//*
//PROCB EXEC PROCA
//*
//CHKIF IF RC ¬= 0 & RC ¬= 98 & RC ¬= 99 THEN
//STEPLST --- STEP INFO ----
// ENDIF


PROC-A has about 10 steps and PROC-B has 2 steps, I need to check if all these 12 steps have completed with/without return codes 0, 98 & 99

Re: Check return codes of all job steps usng IF statement

PostPosted: Thu Oct 15, 2015 6:06 am
by Robert Sample
PROC-A has about 10 steps and PROC-B has 2 steps, I need to check if all these 12 steps have completed with/without return codes 0, 98 & 99
I'm not sure of the relevance of the number of steps -- does not the IF processing apply to the highest step condition code received so far, whether or not the step executes in a PROC? If so, it should not matter if you have 10 steps or 2 steps or 254 steps -- the IF test will look at the highest step condition code. This could cause issues if one (or more) of the PROC steps sets a step condition code higher than 99 -- or if you want to know about specific steps in the PROC (such as that STEP01 got a 98, STEP02 through STEP09 got 00, and STEP10 got a 99; the 99 is all you could test for with IF (RC ... in your JCL).

Re: Check return codes of all job steps usng IF statement

PostPosted: Thu Oct 15, 2015 6:30 pm
by NicC
As each procedure should be a separate job why not run your STEPLST program after each procedure. If necessary use DISP=MOD in the second execution.

Re: Check return codes of all job steps usng IF statement

PostPosted: Thu Oct 15, 2015 9:28 pm
by nkulkarni
Hi Robert Sample,

Thank you for your response.

As per the requirement RCs 0, 98 & 99 are valid ones and anything other is invalid, so a RC 10 or 20 is invalid. If IF is acting only on highest RC then in this case highest RC is valid in most cases.

Any way to get around this?

Re: Check return codes of all job steps usng IF statement

PostPosted: Thu Oct 15, 2015 9:31 pm
by nkulkarni
Hi NicC,

Thank you for your response.

I could have done it but the job is calling a PROC repeatedly with many different parameters in the same JCL so I have 2-3 steps remaining to add this logic, actual PROC executes 7 steps and it has been called 34 times already so adding this step after each procedure crosses JCL step limit.

Could you please inform if there is any way to get around this?

Re: Check return codes of all job steps usng IF statement

PostPosted: Fri Oct 16, 2015 12:20 am
by prino
In other words, you have designed a very bad system, and no amount of fiddling will make it better. I've got a program called "STEPS" that would help, but sadly "STEPS" is not available to outsourcing companies or their employees. :mrgreen: :mrgreen: :mrgreen:

Re: Check return codes of all job steps usng IF statement

PostPosted: Fri Oct 16, 2015 2:12 am
by nkulkarni
Hi Prino,

The system has been this way for many years! and I joined just a month back and was trying to help it. Looks like a lost cause