Conditional Statements IQ for Experienced


What do you mean by Condition checking in JCL?

Condition checking involves validating the execution status of a perticular step to decide the current step execution.

How many conditional statements available in JCL?

Three statements are available - IF, COND and RD parameters.

How do you skip a particular step in a proc/JOB?

Use the conditional parameter like IF with unsatisified condition or COND with satisfied condition.

IF Statement -

What is the significance of IF statement?

"IF" statement is used to execute a step conditionally based on the condition coded. It defines a condition with the return code or condition code of the previous steps.

How may types of IF statements available?

IF statement has three types - Simple IF, IF...ELSE and nested IF...ELSE.

What will happen if you attempt to restart a job in the middle of a JCL // IF .... // ENDIF?

If you attempt to restart a job in the middle of a JCL // IF ... // ENDIF construct, the restart might fail or behave unpredictably because conditional processing might not be properly evaluated or reset. It's generally recommended to restart the job at a logical step outside the conditional block to ensure consistent and correct processing.

A JCL has 2 steps. How to code the JCL such that if step1 abends, then step2 runs. Else, job terminates with step1?

//IFSTEP IF STEP1.RC = 0 THEN //STEP2 EXEC .... //IFSTEPE ENDIF.

A JCL has 10 steps. How to run step4 and step7 (only) without using COND parameter or IF-THEN-ELSE?

IEBEDIT is used to select specific steps of JCL that needs to be run. In the above JCL, the input JCL with 10 steps is present in MTH.PROD.JCLLIB(INPUTJOB). STEP4 and STEP7 is specified in SYSIN of IEBEDIT, so that those two steps are run.

//STEP001 EXEC PGM=IEBEDIT //SYSUT1 DD DSN=MTH.PROD.JCLLIB(INPUTJOB),DISP=SHR //SYSUT2 DD SYSOUT=(*,INTRDR) //SYSPRINT DD SYSOUT=* //SYSIN DD * EDIT TYPE=INCLUDE,STEPNAME=(STEP4,STEP7) /*

COND Parameter -

What is a COND parameter in JCL?

COND parameter is used to specify a condition under which a particular job step should be executed or skipped.

What happens when COND is coded in JOB statement and EXEC statement?

COND in JOB statement applies to each step of the JOB. COND in EXEC statement applies to the specific step.

What is COND=ONLY?

It is used to execute the current step when the previous step execution is unsuccessful.

What is COND=EVEN?

It is used to execute the current step when the previous step execution is successful or unsuccessful.

In order to execute step2 a job after a return code of 8 in step1, what condition you will code in step2?

//STEP1 EXEC PGM=P1 //STEP2 EXEC PGM=P2,COND=(8,NE)

RD Parameter -

What is the significance of RD parameter?

RD stands for restart definition. RD parameter used to - allow JES to perform an automatic job restart after the job failure, allow the operator to perform an automatic job or a checkpoint restart if a job fails.

Frequently Asked Questions -

What is condition checking in JCL? Is this possible?
What is the concept of Condition checking in JCL?

Definition of COND parameter in JCL?
What is the use of COND parameter in JCL?

What is the meaning of the EXEC statement keyword, COND? What is its syntax?
Mention what happens when COND is coded in JOB statement and when COND is coded inside EXEC statement?

What do you mean by "Cond=even" and "Cond=only"?