Check return codes of all job steps usng IF statement



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Check return codes of all job steps usng IF statement

Postby nkulkarni » Thu Oct 15, 2015 1:39 am

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
NK
nkulkarni
 
Posts: 52
Joined: Mon Sep 28, 2015 2:28 pm
Has thanked: 17 times
Been thanked: 0 time

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

 

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

Postby prino » Thu Oct 15, 2015 1:57 am

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.
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 536
Joined: Wed Mar 11, 2009 12:22 am
Location: Oostende, Belgium
Has thanked: 3 times
Been thanked: 21 times

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

Postby nkulkarni » Thu Oct 15, 2015 2:42 am

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
NK
nkulkarni
 
Posts: 52
Joined: Mon Sep 28, 2015 2:28 pm
Has thanked: 17 times
Been thanked: 0 time

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

Postby Robert Sample » Thu Oct 15, 2015 6:06 am

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).
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

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

Postby NicC » Thu Oct 15, 2015 6:30 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

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

Postby nkulkarni » Thu Oct 15, 2015 9:28 pm

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?
NK
nkulkarni
 
Posts: 52
Joined: Mon Sep 28, 2015 2:28 pm
Has thanked: 17 times
Been thanked: 0 time

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

Postby nkulkarni » Thu Oct 15, 2015 9:31 pm

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?
NK
nkulkarni
 
Posts: 52
Joined: Mon Sep 28, 2015 2:28 pm
Has thanked: 17 times
Been thanked: 0 time

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

Postby prino » Fri Oct 16, 2015 12:20 am

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:
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 536
Joined: Wed Mar 11, 2009 12:22 am
Location: Oostende, Belgium
Has thanked: 3 times
Been thanked: 21 times

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

Postby nkulkarni » Fri Oct 16, 2015 2:12 am

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
NK
nkulkarni
 
Posts: 52
Joined: Mon Sep 28, 2015 2:28 pm
Has thanked: 17 times
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post