JCL (COND or IF)



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

JCL (COND or IF)

Postby sanababu » Sat Aug 06, 2011 8:04 pm

in bypass activity which is most suitable wheather COND or IF Statement?????
sanababu
 
Posts: 4
Joined: Wed Jul 13, 2011 6:54 pm
Has thanked: 0 time
Been thanked: 0 time

Re: JCL (COND or IF)

 

Re: JCL

Postby enrico-sorichetti » Sat Aug 06, 2011 8:16 pm

when asking it would be wise to...
use a more intelligent title for Your questions
and post in the proper section of the forum

people willing to help do not like to waste time on questions with stupid/irrelevant titles
and posted in the wrong section
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2644
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: JCL

Postby dick scherrer » Sun Aug 07, 2011 3:16 am

Hello,

As Enrico mentioned, it is best to use a meaningful subject and post in the proper part of the forum.

A subject of JCL is simply a waste. I've slightly modified your subject.

When asking a question you should post what you are working with and where you have a doubt. This is not a texting system and we expect even beginners to post complete thoughts. . .

Once you provide better info, someone will surely have a reply.

I can tell you up front, your answer is "It depends". . . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: JCL (COND or IF)

Postby steve-myers » Sun Aug 07, 2011 3:59 am

As dick scherrer says, it depends.

Many people feel COND is very confusing. I'm among them, and I've been writing JCL for more than 40 years. On the other hand, the // IF statement is quite verbose, and it can be confusing for that reason.

For example -
//A       EXEC PGM=WEEKDAY
//          IF A.RC=0 THEN
//B       EXEC PGM=WTO,PARM='IT''S SUNDAY'
//        ELSE
//          IF A.RC=1 THEN
//C       EXEC PGM=WTO,PARM='IT''S MONDAY'
//        ELSE
//          IF A.RC=2 THEN
//D       EXEC PGM=WTO,PARM='IT''S TUESDAY'
//        ELSE
//          IF A.RC=3 THEN
//E       EXEC PGM=WTO,PARM='IT''S WEDNESDAY'
//        ELSE
//          IF A.RC=4 THEN
//F       EXEC PGM=WTO,PARM='IT''S THURSDAY'
//        ELSE
//          IF A.RC=5 THEN
//G       EXEC PGM=WTO,PARM='IT''S FRIDAY'
//        ELSE
//          IF A.RC=6 THEN
//H       EXEC PGM=WTO,PARM='IT''S SATURDAY'
//        ELSE
//I       EXEC PGM=WTO,PARM='I DON''T KNOW WHAT THE WEEK DAY IS!'
//       ENDIF
//       ENDIF
//       ENDIF
//       ENDIF
//       ENDIF
//       ENDIF
//       ENDIF
The WEEKDAY program returns the day of the week when it's run as a return code from 0 to 6, and WTO does what it appears to do.

Compare the previous JCL with -
//A       EXEC PGM=WEEKDAY
//B       EXEC PGM=WTO,COND=(0,NE,A),PARM='IT''S SUNDAY'
//C       EXEC PGM=WTO,COND=(1,NE,A),PARM='IT''S MONDAY'
//D       EXEC PGM=WTO,COND=(2,NE,A),PARM='IT''S TUESDAY'
//E       EXEC PGM=WTO,COND=(3,NE,A),PARM='IT''S WEDNESDAY'
//F       EXEC PGM=WTO,COND=(4,NE,A),PARM='IT''S THURSDAY'
//G       EXEC PGM=WTO,COND=(5,NE,A),PARM='IT''S FRIDAY'
//H       EXEC PGM=WTO,COND=(6,NE,A),PARM='IT''S SATURDAY'
steve-myers
Global moderator
 
Posts: 1886
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

Re: JCL (COND or IF)

Postby MrSpock » Sun Aug 07, 2011 4:49 am

I'm an IF/THEN/ELSE guy myself, always have been. Just my preference.
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

Re: JCL (COND or IF)

Postby Ed Goodman » Mon Aug 08, 2011 7:20 pm

My guess would be that younger folks would like the if/then/else better. I'm right on the cusp and have used both enough to see they have advantages.

For new JCL, I would code it using if/then/else, but make it so that the jobs are short (few steps) and are always restarted from the top should something go wrong.

Older jobs with twenty steps and two main IMS programs that may need a restart on steps 5 12 and 17 should keep the COND statements.
Ed Goodman
 
Posts: 342
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post