Solved

query regarding cond codes

Posted on 2011-09-23
12
672 Views
Last Modified: 2012-05-12
what is the meaning of Cond Codes in JCL

JCL COND Codes are used to execute steps based on the condition that previous executed statement does not have

specified return code.

For example COND=(0,NE)- It means that if the return code (RC) of every previous step is equal to zero then
execute this step.


Am I right or I have missed something. If no then please explain it with an example.

Regards
Karan Gupta
0
Comment
Question by:KaranGupta
12 Comments
 
LVL 34

Expert Comment

by:Gary Patterson
Comment Utility
It has been many, many years since I had to write any JCL, but I'll try to help:

See the "Conditional Processing" section of the this page for a good explanation and examples, including comparative pseudocode:

http://en.wikipedia.org/wiki/Job_Control_Language

This tutorial also presents a mechanism for converting English language conditional logic into JCL COND parameters.  It is a little confusing at first, but it does present a good number of examples:

http://teaching.idallen.org/dat2330/01s/jclnotes/conditionCodes.txt

- Gary Patterson
0
 
LVL 4

Expert Comment

by:Ambusy
Comment Utility
COND=(0,NE) does NOT execute the step, if the condition  is true.
COND=(4,GT) would execute if all rc's were less or equal to 4. (NOT is any > 4)
And likewise.
As there is no stepname (as 3rd parameter)( the test is made against every prededing step.
If a stepname is specified the returncode of that step only is tested.
0
 
LVL 4

Expert Comment

by:Ambusy
Comment Utility
If you are writing (or changing) JCL, change to IF THEN ELSE ENDIF.
A bit easiere to understand, though always IBM-JCL, not the best there is, but then it's over 40 years since HASP was invented, and Jes3 is still compatible with the Houston Automatic Spool.
0
 
LVL 57

Expert Comment

by:giltjr
Comment Utility
I agree with Ambusy, if you are creating new jobs or updating old ones, go with the new IF THEN statements.  Much easier to understand.

Even with 25+ years of coding JCL, the old COND= still confuses me and takes me awhile to figure out in some cases.

The IF/THEN/ELSE/ENDIF makes it a lot easier.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:KaranGupta
Comment Utility
Hi

Please check it now

=========================================================
JCL Cond Codes are used to decide whether to execute the current step or not, based on the return code(RC) of the previously executed step.
 
For example: 1. //STEP02 EXEC PGM=PROG03,COND=(8,LE)
- It means that “STEP02” will not be executed if the return code of every executed previous step is greater than equal to 8.
 
2. //STEP02 EXEC PGM=PROG02,COND=(4,GT,STEP01)
- It means that “STEP02” will not be executed if the return code of “STEP01” is less than equal to 4.
 
So we can conclude that the COND parameter on the EXEC statement will skip this step if the condition is TRUE for *any* of the previous steps.
====================================================================
0
 
LVL 37

Expert Comment

by:TommySzalapski
Comment Utility
Very close. Just remember the differences with GT and GE
LE (<=) is the compliment of GT (>), LT (<) is the compliment of GE (>=)

I annotated some modifications.

=========================================================
JCL Cond Codes are used to decide whether to execute the current step or not, based on the return code(RC) of the previously executed steps.       <---added the s
 
For example: 1. //STEP02 EXEC PGM=PROG03,COND=(8,LE)
- It means that “STEP02” will not be executed if the return code of every executed previous step is greater than 8.
 
2. //STEP02 EXEC PGM=PROG02,COND=(4,GT,STEP01)
- It means that “STEP02” will not be executed if the return code of “STEP01” is less than equal to 4.
 
So we can conclude that the COND parameter on the EXEC statement will skip this step if the condition is TRUE for the specified step or *any* of the previous steps if no step is specified.
====================================================================
0
 
LVL 45

Expert Comment

by:aikimark
Comment Utility
It is such reverse-logic handling of step conditional execution that many shops recoded their JCL into REXX or TSO scripts.
0
 
LVL 57

Accepted Solution

by:
giltjr earned 250 total points
Comment Utility
Using IF THEN ELSE in JCL makes it much easier.  Your example:

     //STEP02 EXEC PGM=PROG03,COND=(8,LE)

Is changed to:

     //IF01  IF RC <= 8 THEN
     //STEP02 EXEC PGM=PROG03
     //ENDIF01

or even:

     //IF01  IF RC > 9 THEN
     //STEP02 EXEC PGM=PROG03
     //ENDIF01

And:

     //STEP02 EXEC PGM=PROG02,COND=(4,GT,STEP01)

Is changed to:

     //IF01  IF STEP01.RC > 4 THEN
     //STEP02 EXEC PGM=PROG02
     //ENDIF01

Also with the IF-THEN-ELSE you can have real else's like:

     //IF01  IF STEP01.RC > 4 THEN
     //STEP02A EXEC PGM=PROG02
     // ELSE
     //STEP02B EXEC PGM=PROG09
     //ENDIF01

You can also using things like IF ABEND or IF RUN.  IF ABEND will run a step if a prior step abended.  IF RUN will run a step if a prior step ran.  You can use NOT's, AND's and OR's.  The JCL IF-THEN-ELSE is just like any other IF-THEN-ELSE.

Although you can convert to REXX, TSO CLIST, or some other "scripting" language, using JCL IF-THEN-ELSE does require any major changes to your job steams.
0
 

Assisted Solution

by:monro1964
monro1964 earned 250 total points
Comment Utility
{Edited by _alias99}

The way you use the COND code command on this question (See on TOP), the Steps with COND command are EXECUTE only if the result of the COND condition is FALSE.

I know, it confusing.


You can also look at a new way to code the COND command. It is if IF and ENDIF. It is more easy to understand.


//S1     exec myproc1
//cond01 if rc = 0 then
//c01ok  exec myproc2
//c01e   else
//c01els exec myproc3
//       endif


or

//S1     exec myproc2
//*
//s2     exec myproc1
//*
//cond03 if s2.rc = 0 then
//c03ok  exec myproc2
//c03e   else
//c03els exec myproc3
//       endif
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
dividesSelf challange 15 77
matchUp  challenge 9 71
count8 challlenge 13 84
Adding Namespace to the second node of the xml 16 30
I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now