Fun JCL Question



Post anything related to mainframes (IBM & UNISYS) if not fit in any of the above categories

Fun JCL Question

Postby Aki88 » Fri Nov 21, 2014 12:10 pm

Hello,

Here is fun JCL question, take a dig :D

<Disclaimer: This is not a query; it is not pointed to moderators/senior members, though you're welcome to take pot-shots at it for laughs only :P ; this is entirely to test a beginner's own understanding of COND parameter in JCLs; you can use this question to play around with your JCL working on various scenarios; in case a moderator feels that this topic can lead to helpful info, it can be moved to JCL part of the forum with edits. To those attempting the question - ensure that you test your solutions prior to posting them.>

Requirement: Skip the first step in a multi-step JCL using COND parameter; you're allowed to use only and only COND parameter to achieve this.

Cheerio. :)
Aki88
 
Posts: 381
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times

Re: Fun JCL Question

Postby BillyBoyo » Fri Nov 21, 2014 12:50 pm

OK. The answer is undocumented and somewhat counter-intuitive, and should not be used in Prodiction, Trying to find it could get people finding out more about COND on the way, we'll see.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Fun JCL Question

Postby Terry Heinze » Fri Nov 21, 2014 8:20 pm

If allowed to insert an additional step as the 1st step, the following would work:
//xxxxxxxx JOB (xxxxx,xxxx),'TERRY HEINZE -- xxxx',
//             CLASS=B,
//             MSGCLASS=H,
//             NOTIFY=&SYSUID
//S01     EXEC PGM=IEFBR14
//S02     EXEC PGM=IEFBR14,
//             COND=(0,EQ)
//S03     EXEC PGM=IEFBR14
//

What was the 1st step now becomes step S02 (the original 1st step).
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times

Re: Fun JCL Question

Postby BillyBoyo » Fri Nov 21, 2014 8:34 pm

Yes, but that is doing more than just using COND and still what is now the first step in the JOB will be executed.

The idea is a COND on the first step in the JOB which will prevent that first step executing. You'll need to "suspend disbelief" and look at what is available for COND. Don't say to yourself "that won't work because..." because one of them will :-)

These users thanked the author BillyBoyo for the post:
Aki88 (Sat Nov 22, 2014 12:10 pm)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Fun JCL Question

Postby Terry Heinze » Fri Nov 21, 2014 9:51 pm

Okay, after a bit of trial and error, I found the following worked:
//xxxxxxxx JOB (xxxxx,xxxx),'TERRY HEINZE -- xxxx',
//             CLASS=B,
//             MSGCLASS=H,
//             NOTIFY=&SYSUID
//S01     EXEC PGM=IEFBR14,
//             COND=(ONLY)     BYPASS
//S02     EXEC PGM=IEFBR14     EXECUTE
//S03     EXEC PGM=IEFBR14     EXECUTE
//

I HATE COND. I much prefer IF/THEN/ELSE/ENDIF.
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times

Re: Fun JCL Question

Postby BillyBoyo » Fri Nov 21, 2014 10:07 pm

Yep. Only if the previous step abended, the first step runs. No previous step, so didn't abend, so step doesn't run. Someone showed it to me a couple of months ago, and I didn't believe it till I ran it myself :-)

It is not documented (that I can find) so behaviour can change without warning in a future z/OS release, so don't use it. COND is, shall we say, esoteric.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Fun JCL Question

Postby Robert Sample » Fri Nov 21, 2014 10:38 pm

The JCL Reference manual explicitly states that COND on the first EXEC of a job evaluates to false to allow the step to execute. ONLY extends this documented behavior.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Fun JCL Question

Postby BillyBoyo » Fri Nov 21, 2014 11:23 pm

Except it doesn't run. And the documentation doesn't say "except for COND=ONLY". It's exactly what I thought when I saw it first :-) Took me running a JOB to realise what I was being shown. Despite what is documented for COND on the first step, COND=ONLY makes the step not run. Yes, according to the documentation the first step should always run, irrespective of COND.

These users thanked the author BillyBoyo for the post:
Aki88 (Sat Nov 22, 2014 12:13 pm)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Fun JCL Question

Postby Terry Heinze » Sat Nov 22, 2014 12:22 am

I think Figure 16-2 in the Reference Manual documents this situation:
"16.5.7 Summary of COND Parameters"
The 1st of the 4 ONLY scenarios is the one that applies, I believe. So it IS documented.
© Copyright IBM Corp. 1988, 2001
I STILL hate COND. :(
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times

Re: Fun JCL Question

Postby BillyBoyo » Sat Nov 22, 2014 5:42 am

I don't think so. It is logically impossible for a previous step to have abended (there is no previous step). That can't just be lumped together with no destinction between it and the case where no previous actual step has abended.

It does mean if your COND=ONLY step fails, you have to override the COND (to anything other than ONLY) to get it to to be the target of a RESTART and actually execute. I think that if the actual behaviour of COND=ONLY on the first step was the intended behaviour, that would need to be documented.

I wonder if it always worked like that. Cue someone with Hercules running MVS 3.8J...
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Next

Return to All other Mainframe Topics

 


  • Related topics
    Replies
    Views
    Last post