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