View previous topic :: View next topic
|
Author |
Message |
RedDevil711
New User
Joined: 04 Jun 2010 Posts: 25 Location: Pune
|
|
|
|
Can we use and IF ELSE condition on a JCL step based on the value of a SYMBOLIC parameter ? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
why not click on the IBM manuals link at the top of the page
look at
zOS JCL reference
and
zOS JCL user guide
and find out Yourself! |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
Or could you not try this in about one minute?
I mean really folks, how lazy can you get?
If you aspire to be your shop's guru, then learn how to just do something already. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Sure. If I define a valid symbolic:
Code: |
// SET CND='STEP0001.RC GT 0' |
and then use that in my job ...
Code: |
//*
//STEP0001 EXEC PGM=...
//*
// IF &CND THEN
//STEP0002 EXEC PGM=...
// ENDIF
//* |
it will work as you'd expect.
Although, I'm not sure I see a practical application of this concept. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Phrzby Phil wrote: |
Or could you not try this in about one minute?
I mean really folks, how lazy can you get?
If you aspire to be your shop's guru, then learn how to just do something already. |
Without attempting to defend the TS, I'll note that I've been accused of practicing the black arts in writing my own JCL. The attitude -- defended by some of the senior members of this board -- that this late in history everything has been done, and that the preferred way to create X is to "clone" Y and make the absolute minimum of changes, is probably responsible for this. |
|
Back to top |
|
|
RedDevil711
New User
Joined: 04 Jun 2010 Posts: 25 Location: Pune
|
|
|
|
@ Phil && @ enrico it is not that i did not try myself / scan the manuals on the forum before posting..all the manual says is that we can use RC/ABEND CC/USER ABEND CODES for if and else condition.
i actually have a symbolic parameter...user_code whose value can be 'V'/'F'. if it is 'F' i need to copy user info onto a file in a FB format..with DSN parameters and if it is 'V' i need to go and copy user data to a VSAM.. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
all the manual says is that we can use RC/ABEND CC/USER ABEND CODES for if and else condition. |
if that is what the manual says, then You cannot use anything else! |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
RedDevil711 wrote: |
@ Phil && @ enrico it is not that i did not try myself / scan the manuals on the forum before posting..all the manual says is that we can use RC/ABEND CC/USER ABEND CODES for if and else condition.
i actually have a symbolic parameter...user_code whose value can be 'V'/'F'. if it is 'F' i need to copy user info onto a file in a FB format..with DSN parameters and if it is 'V' i need to go and copy user data to a VSAM.. |
Then you should look at what Kevin has suggested. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
IIRC, the manual actually states using anything other than the allowed constructs in an IF statement results in unpredictable results.
People new to JCL want to use the IF statement like they would a programming language IF statement. The JCL IF statement is actually a very, very, very restricted statement and is good only for certain applications. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
RedDevil711 wrote: |
i actually have a symbolic parameter...user_code whose value can be 'V'/'F'. if it is 'F' i need to copy user info onto a file in a FB format..with DSN parameters and if it is 'V' i need to go and copy user data to a VSAM.. |
So, you write a little piece of code that reads that parameter (a symbolic parameter can be used in the "PARM=" sub-parameter) and either actually writes the data set, or at worse returns an actual return code to control conditional execution of subsequent steps.
Dr. Sorichetti is entirely correct in saying that if a manual says "You may do X or Y', then X or Y are your only choices. You may luck into finding some undocumented logic (there is some in the DSP that interprets the IF construct), but IBM may arbitrary change it at any time in the future, and if it stops working IBM will tell you "Too bad, so sad". |
|
Back to top |
|
|
|