There are 3 steps in my JCL:
STEP 1: process STEP 2: NDM STEP 3: DELETE OUTPUT after NDM
What I want to accomplish? I want to execute STEP 3 no matter what the return code of step 2 is.
I tried this: COND=(16,GT) and COND=(16,ST,STEP 2) but it's not doing what I want to do.
Try COND=EVEN on your final step’s EXEC statement.
From the documetnation:
COND=EVEN tells MVS to execute this job step EVEN IF a prior step in the same job abends, unless the job is canceled by the MVS operator.
There's also a COND=ONLY:
COND=ONLY tells MVS to execute this job step ONLY IF a prior step in the same job abends.
Explanation of COND:
COND is fairly counter-intuitive. The description is:
If none of these tests is satisfied, the system executes the job step; if any test is satisfied, the system skips the job step on which the COND= parameter is coded.
So your COND=(16,GT) means "If 16 is greater than the return code from any previous steps, don't execute this step". So this step would only execute if ALL the previous steps finished with a RC > 16.
COND=(16,ST,STEP 2) is invalid - ST is not a valid condition. Valid tests are :
EQ - equal
LT - less than
LE - less than or equal to
NE - not equal
GT - greater than
GE - greater than or equal to
To make a step run, no matter what the condition codes from previous steps are, you could code COND=(0,GT), which means 'if 0 is greater than any previous return code (which it won't be), skip this step.'.
To be safe, you could code:
COND=((0,GT),EVEN)
as EVEN will cause this step to execute even if a previous step ABENDs.