Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

query regarding cond codes

Posted on 2011-09-23
12
Medium Priority
?
725 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 35

Expert Comment

by:Gary Patterson
ID: 36590374
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
ID: 36592827
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
ID: 36592877
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 57

Expert Comment

by:giltjr
ID: 36594127
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
 

Author Comment

by:KaranGupta
ID: 36901454
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
ID: 36944410
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 46

Expert Comment

by:aikimark
ID: 36944672
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 1000 total points
ID: 36948220
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 1000 total points
ID: 36957933
{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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Simple Linear Regression

636 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