Bulletin Board

What’s new at MAINFRAMES 360
(Updates)...
- Re-writing of select JCL and VSAM Tutorials is under-way, orientation would be more hands-on, and practical
- New Tutorials on COBOL-VSAM programs shall be put up pretty soon
- IMS DB/DC Tutorials to start up in April, 2010

Mainframes360 Search

Loading

Quick Links

Jump to :  

Wednesday, April 1, 2009

COND Statement – How does it work?


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.  

0 comments:

Post a Comment

Related Posts with Thumbnails

Quick Links

Jump to :  

Note :

© Copyright – Quasar Chunawalla, 2010.
Note : The copyrights of all the material, text and pictures posted in this website belong to the author. Any instance of lifting the material from this website, shall be considered as an act of plagiarism. For any clarifications, please mail at quasar.chunawalla@gmail.com
 
back to top