Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
JCL COND CODE check

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
juares castro

New User


Joined: 04 May 2012
Posts: 25
Location: Brazil

PostPosted: Tue Jun 26, 2018 7:43 pm    Post subject: JCL COND CODE check
Reply with quote

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
View user's profile Send private message

daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 714
Location: Pennsylvania

PostPosted: Tue Jun 26, 2018 7:54 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8405
Location: Dubuque, Iowa, USA

PostPosted: Tue Jun 26, 2018 8:23 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 282
Location: Cincinnati OH USA

PostPosted: Tue Jun 26, 2018 10:38 pm    Post subject:
Reply with quote

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
View user's profile Send private message
juares castro

New User


Joined: 04 May 2012
Posts: 25
Location: Brazil

PostPosted: Tue Jun 26, 2018 11:43 pm    Post subject: Reply to: JCL COND CODE check
Reply with quote

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
View user's profile Send private message
jasorn
Warnings : 1

Active User


Joined: 12 Jul 2006
Posts: 184
Location: USA

PostPosted: Sat Aug 11, 2018 9:43 pm    Post subject: "If true, don't do", is how I was taught to remember it.
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Will this code extract 1 byte from fi... pkmurali CLIST & REXX 8 Sat Nov 10, 2018 11:13 pm
No new posts SQL CODE 206 Ashishpanpaliya DB2 12 Wed Oct 10, 2018 9:20 pm
No new posts Cond parameter srini24 JCL & VSAM 10 Sun Sep 09, 2018 2:06 am
No new posts Invoke WebService failing with respon... Ashishpanpaliya CICS 3 Thu Aug 09, 2018 3:14 pm
This topic is locked: you cannot edit posts or make replies. IO-PCB status code AL srinianusuya IMS DB/DC 1 Mon Aug 06, 2018 10:26 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us