|
View previous topic :: View next topic
|
| Author |
Message |
juares castro
New User
Joined: 04 May 2012 Posts: 34 Location: Brazil
|
|
|
|
Hi everyone!
(silly (?) question)
I am trying to prove some things I had as true.
I mean, in a job, the greatest COND CODE produced is the current one we have to compare. Please check the job I have ran checking COND CODE:
| Code: |
//CONDCOD1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
SET MAXCC=5
//*
//CONDCOD2 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
SET MAXCC=10
//*
//*
//CHECK001 EXEC PGM=IEFBR14,COND=(0,NE)
//*
//CHECK002 EXEC PGM=IEFBR14,COND=(1,NE)
//*
//CHECK003 EXEC PGM=IEFBR14,COND=((3,NE,CONDCOD1),(6,NE,CONDCOD2))
//*
//CHECK0A3 EXEC PGM=IEFBR14,COND=((5,NE,CONDCOD1),(6,EQ,CONDCOD2))
//*
//CHECK004 EXEC PGM=IEFBR14,COND=(3,NE,CONDCOD1)
//*
//CHECK005 EXEC PGM=IEFBR14,COND=(3,GT,CONDCOD1)
//*
//CHECK006 EXEC PGM=IEFBR14,COND=(6,GT,CONDCOD2)
//*
//CHECK007 EXEC PGM=IEFBR14,COND=(11,LT)
//*
//CHECK008 EXEC PGM=IEFBR14,COND=(7,GT)
//*
//CHECK009 EXEC PGM=IEFBR14,COND=(7,GT,CONDCOD1)
//*
//CHECK010 EXEC PGM=IEFBR14,COND=(7,GT,CONDCOD2)
//*
//CHECK011 EXEC PGM=IEFBR14,COND=(5,GT)
//*
//CHECK012 EXEC PGM=IEFBR14,COND=(3,GT)
//*
//CHECK013 EXEC PGM=IEFBR14,COND=(2,GT,CONDCOD1)
//*
|
Running that we have the result below:
| Code: |
CONDCOD1 IDCAMS RC=0005
CONDCOD2 IDCAMS RC=0010
CHECK001 IEFBR14 Flushed
CHECK002 IEFBR14 Flushed
CHECK003 IEFBR14 Flushed
CHECK0A3 IEFBR14 RC=0000
CHECK004 IEFBR14 Flushed
CHECK005 IEFBR14 RC=0000
CHECK006 IEFBR14 RC=0000
CHECK007 IEFBR14 RC=0000
CHECK008 IEFBR14 Flushed
CHECK009 IEFBR14 Flushed
CHECK010 IEFBR14 RC=0000
CHECK011 IEFBR14 Flushed
CHECK012 IEFBR14 Flushed
CHECK013 IEFBR14 RC=0000
|
My question is: why step "CHECK007" runs and "CHECK008" does not?
Thanks in advance! |
|
| Back to top |
|
 |
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Step CHECK008 is flushed because 7 is greater than the rc=000
of step CHECK007 (and several others).
As an aside, I find COND processing very confusing (ass-backwards logic).
The newer IF THEN ELSE construct is much more straight forward. |
|
| Back to top |
|
 |
Robert Sample
Global Moderator

Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
CHECK007 executes because the system evaluates 11 against all previous step condition codes and finds that none of them are greater than 11. Hence the step is NOT bypassed and executes.
CHECK008 does not execute because the system evaluates 7 against all previous step condition codes and finds that 7 is greater than at least one of them. Hence the step will be bypassed.
The JCL Reference manual (V2R3) on page 352 says
| Quote: |
| If the return code issued by any of those previous steps causes the test condition to be satisfied, the system evaluates the COND parameter as true and bypasses the job step. |
|
|
| Back to top |
|
 |
dneufarth
Active User

Joined: 27 Apr 2005 Posts: 420 Location: Inside the SPEW (Southwest Ohio, USA)
|
|
|
|
NERTS
any are true, skip
Old school tip to results of processing cond=
As Dave suggested, IF THEN ELSE is way to go. |
|
| Back to top |
|
 |
juares castro
New User
Joined: 04 May 2012 Posts: 34 Location: Brazil
|
|
|
|
Thanks everyone!
Robert, paying attention now, it seems very easy with your explanation.
It checks against all RC produced until the step. |
|
| Back to top |
|
 |
jasorn Warnings : 1 Active User
Joined: 12 Jul 2006 Posts: 191 Location: USA
|
|
|
|
That might help those who find this to be confusing and has to deal with this format versus 'IF'.
Since we're on the subject, one thing I find that trips people up with COND= is that EVEN isn't always something you want to rely on, especially for non production applications you want to work without someone needing to check on things. Reason being is that jobs can fail in ways that immediate halt the job.
For this type of application, I submit some kind of checker job that will let me know if the job failed.
I still code EVEN, but I also run a checker job for non prod jobs or test jobs when I can't use a proper system that alerts someone failures. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|