JCL – How to Execute Only Even Steps

Here’s is resolution to execute only EVEN steps in JCL. There are multiple steps in a JCL Job. The idea is to run only even numbered steps and to skip odd numbered steps. It’s also an interview question asked recently.

Interview Question

Here are four steps in a Job, and questions is to execute only EVEN steps (2 and 4).

//JOBNAME  JOB ...  ...
//STEP01 STEP ..
//STEP02 STEP...
//STEP03 STEP...
//STEP04 STEP ...

Resolution to Run Only Even Steps

Before you try to answer. Remember these points. In JCL, you control steps execution by three methods. Those are COND, IF ELSE and RESTART parameters.

Keep Reading

The syntax for COND:

COND=([(value,operator[,stepname])…]
[ ,{EVEN} {ONLY}])

I am just giving here the top methods that control job steps

  1. COND
  2. IF ELSE
  3. RESTART

Notes on these

  • COND parameters, you can give in both JOB and Step
  • RESTART Parameters only in Job card
  • IF ELSE only in STEPs

Resolution

//JOBNAME JOB … …

// RESTART=STEP02

//STEP01 STEP ..

//STEP02 STEP…

//STEP03 STEP…

COND=(0, EQ, STEP02)

//STEP04 STEP…

Explanation

The RESTART at JOB card sends the control to STEP02. In STEP03, I’ve added COND=(0, EQ, STEP02). With this, it skips STEP03, as the return code from STEP02 is ‘0’. Finally, the control goes to STEP04.

Here STEP01 and STEP03 skipped and executed STEP02 and STEP04 (Even Steps).

Now you achieved.

Related Posts

Get new content delivered directly to your inbox.

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.