Guys,
dumb question If i code at step level Cond=(0,eq) Would it checking the condition codes for just the previous step or all the previous steps in a JCL.
Question on COND in JCL.
-
- New Member
- Posts: 9
- Joined: Wed Feb 24, 2016 11:30 am
Re: Question on COND in JCL.
I thought it was checking all the previous steps but my job had a rc5 from second step and step5 had this coded, So ideally step5 should have run from my understanding
So if any step had a rc 5, it would have executed right
But it did not Looks like esp pulled the job as soon as it got a 5 and didn’t even check any thing else
So if any step had a rc 5, it would have executed right
But it did not Looks like esp pulled the job as soon as it got a 5 and didn’t even check any thing else
Re: Question on COND in JCL.
Hello.
I somehow think the manuals are misleading on the subject of "COND". It says that the step is bypassed if the condition is true, but in practice it would appear to be the opposite. Take a look at the IBM-supplied compiler procedures that have links specified and you will find "COND=(8,LT)" on the link step which results in condition codes less than 8 causing the step to run. CC 4 from the compiler is a warning, CC 8 and above are errors. If the step is supposed to be bypassed on compiler errors then, according to the manual, it should be "COND=(8.GE)" but that's not the case.
But anyways... when specifying "COND" without referencing a specific step you are back-referencing all previous steps, so it is a "highest condition code so far" test. If step 2 gave CC 5, then step 5 should not have run because you are asking it only to run when all previous steps completed with CC 0.
If CC 5 is acceptable in preceding steps then "COND=(5,LE)" would seem to be more appropriate. Alternatively, if it's only step 2 that step 5 is worried about, then you can add the specific step name to the parameters, e.g. "COND=(5,LE,STEP2)". Alternatively, if you want the step to run only if the condition code is not zero, then use "COND=(0,NE)" or "COND=(0,GT)", or "COND=(5,EQ)" if you want to run only if you have CC 5.
Personally, I never really liked the "COND" parameter. It was too easily missed and, to my mind, too limited. These days I much prefer using the "IF/THEN/ELSE/ENDIF" statements as they are much clearer and easier to deal with: https://www.ibm.com/docs/en/zos/3.1.0?t ... -construct
I somehow think the manuals are misleading on the subject of "COND". It says that the step is bypassed if the condition is true, but in practice it would appear to be the opposite. Take a look at the IBM-supplied compiler procedures that have links specified and you will find "COND=(8,LT)" on the link step which results in condition codes less than 8 causing the step to run. CC 4 from the compiler is a warning, CC 8 and above are errors. If the step is supposed to be bypassed on compiler errors then, according to the manual, it should be "COND=(8.GE)" but that's not the case.
But anyways... when specifying "COND" without referencing a specific step you are back-referencing all previous steps, so it is a "highest condition code so far" test. If step 2 gave CC 5, then step 5 should not have run because you are asking it only to run when all previous steps completed with CC 0.
If CC 5 is acceptable in preceding steps then "COND=(5,LE)" would seem to be more appropriate. Alternatively, if it's only step 2 that step 5 is worried about, then you can add the specific step name to the parameters, e.g. "COND=(5,LE,STEP2)". Alternatively, if you want the step to run only if the condition code is not zero, then use "COND=(0,NE)" or "COND=(0,GT)", or "COND=(5,EQ)" if you want to run only if you have CC 5.
Personally, I never really liked the "COND" parameter. It was too easily missed and, to my mind, too limited. These days I much prefer using the "IF/THEN/ELSE/ENDIF" statements as they are much clearer and easier to deal with: https://www.ibm.com/docs/en/zos/3.1.0?t ... -construct
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute