| Q. How does the COND statement work? |
| The COND statement is used to bypass Job-step. Example 1 Consider the statement //STEP02 EXEC PGM=IEFBR14,COND=(4,GT,STEP01) r In this example, if condition-code of STEP1 is between 0 to 3, the COND condition is satisfied. Thus, STEP02 is bypassed. Example 2 Consider the statement, //STEP02 EXEC PGM=IEFBR14,COND=((16,GE),(90,LE,STEP1),ONLY) In the above example, the system executes this step if all of the three conditions are met, 1. Return codes of Any of the previous job-steps is 17 or greater. 2. Return code of STEP1 is 89 or less. 3. Any of the previous step abnormally terminates. Example 3 Consider the series of statements : //STEP01 EXEC PGM=IEFBR14 //STEP02 EXEC PGM=IEFBR14,COND=(0,EQ,STEP01) //STEP03 EXEC PGM=IEFBR14,COND=((8,LT,STEP01),(8,GT,STEP02)) In the above scenario, assume the system successfully executes STEP01 with Return Code=0. The system finds that 0 is equal to return code of STEP01 i.e. 0. So, STEP02 is bypassed. When the system evaluates condition on STEP03, it finds that 8 is greater than return code of STEP01(we don’t consider the other part of the condition, since STEP02 was bypassed). Since, 8 > 0, the system executes STEP03. |
| Rule : Bypassing a job-step because of a return code test, is not the same as abnormally terminating the job-step. |
| You can now try and predict in this JCL, which job-steps the system executes, and which job-steps are bypassed... Answer : System executes STEP01. Return Code = 0. (4,LT,0) false. System executes STEP02. Return Code = 0. (16,GE,return code of any preceding step) true. System bypasses STEP03. Technorati Tags: COND,Condition,COND on EXEC,COND on JOB,EQ,NE,GE,GT,LE,LT,job-step,COND Parameter,How COND parameter works,IEFBR14 |
|
|
|
- We are a cosmopolitan community of 400 members, from around the globe. - Working on writing and publishing articles on CICS. - Special article on "How do I learn Mainframe Programming" |
