Mainframes 360
The one stop destination for System Z professionals

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

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,


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 :


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.  

To many people who are thrown to work at a mainframe computer on their first job, they feel lost. Mainframe people seem to speak a completely different language and that doesn't make life easy. What's more, the books and manuals are incredibly hard to comprehend.

"What on earth is a Mainframe?" is an absolute beginner's guide to mainframe computers. We'll introduce you to the hardware and peripherals. We'll talk about the operating system, the software installed on a mainframe. We'll also talk about the different people who work on a mainframe. In a nutshell, we'll de-mystify the mainframe.

Readers based in India, can buy the e-book for Rs. 50 only or the print book. International readers based in the US and other countries can click here to purchase the e-book.