Link to home
Start Free TrialLog in
Avatar of KaranGupta
KaranGupta

asked on

query regarding cond codes

what is the meaning of Cond Codes in JCL

JCL COND Codes are used to execute steps based on the condition that previous executed statement does not have

specified return code.

For example COND=(0,NE)- It means that if the return code (RC) of every previous step is equal to zero then
execute this step.


Am I right or I have missed something. If no then please explain it with an example.

Regards
Karan Gupta
Avatar of Gary Patterson, CISSP
Gary Patterson, CISSP
Flag of United States of America image

It has been many, many years since I had to write any JCL, but I'll try to help:

See the "Conditional Processing" section of the this page for a good explanation and examples, including comparative pseudocode:

http://en.wikipedia.org/wiki/Job_Control_Language

This tutorial also presents a mechanism for converting English language conditional logic into JCL COND parameters.  It is a little confusing at first, but it does present a good number of examples:

http://teaching.idallen.org/dat2330/01s/jclnotes/conditionCodes.txt

- Gary Patterson
COND=(0,NE) does NOT execute the step, if the condition  is true.
COND=(4,GT) would execute if all rc's were less or equal to 4. (NOT is any > 4)
And likewise.
As there is no stepname (as 3rd parameter)( the test is made against every prededing step.
If a stepname is specified the returncode of that step only is tested.
If you are writing (or changing) JCL, change to IF THEN ELSE ENDIF.
A bit easiere to understand, though always IBM-JCL, not the best there is, but then it's over 40 years since HASP was invented, and Jes3 is still compatible with the Houston Automatic Spool.
I agree with Ambusy, if you are creating new jobs or updating old ones, go with the new IF THEN statements.  Much easier to understand.

Even with 25+ years of coding JCL, the old COND= still confuses me and takes me awhile to figure out in some cases.

The IF/THEN/ELSE/ENDIF makes it a lot easier.
Avatar of KaranGupta
KaranGupta

ASKER

Hi

Please check it now

=========================================================
JCL Cond Codes are used to decide whether to execute the current step or not, based on the return code(RC) of the previously executed step.
 
For example: 1. //STEP02 EXEC PGM=PROG03,COND=(8,LE)
- It means that “STEP02” will not be executed if the return code of every executed previous step is greater than equal to 8.
 
2. //STEP02 EXEC PGM=PROG02,COND=(4,GT,STEP01)
- It means that “STEP02” will not be executed if the return code of “STEP01” is less than equal to 4.
 
So we can conclude that the COND parameter on the EXEC statement will skip this step if the condition is TRUE for *any* of the previous steps.
====================================================================
Very close. Just remember the differences with GT and GE
LE (<=) is the compliment of GT (>), LT (<) is the compliment of GE (>=)

I annotated some modifications.

=========================================================
JCL Cond Codes are used to decide whether to execute the current step or not, based on the return code(RC) of the previously executed steps.       <---added the s
 
For example: 1. //STEP02 EXEC PGM=PROG03,COND=(8,LE)
- It means that “STEP02” will not be executed if the return code of every executed previous step is greater than 8.
 
2. //STEP02 EXEC PGM=PROG02,COND=(4,GT,STEP01)
- It means that “STEP02” will not be executed if the return code of “STEP01” is less than equal to 4.
 
So we can conclude that the COND parameter on the EXEC statement will skip this step if the condition is TRUE for the specified step or *any* of the previous steps if no step is specified.
====================================================================
It is such reverse-logic handling of step conditional execution that many shops recoded their JCL into REXX or TSO scripts.
ASKER CERTIFIED SOLUTION
Avatar of giltjr
giltjr
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial