Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

JCL if else condition

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
RedDevil711

New User


Joined: 04 Jun 2010
Posts: 25
Location: Pune

PostPosted: Thu Mar 03, 2011 12:20 pm    Post subject: JCL if else condition
Reply with quote

Can we use and IF ELSE condition on a JCL step based on the value of a SYMBOLIC parameter ?
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Mar 03, 2011 1:15 pm    Post subject: Reply to: JCL if else condition
Reply with quote

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

Active Member


Joined: 31 Oct 2006
Posts: 961
Location: Richmond, Virginia

PostPosted: Thu Mar 03, 2011 6:15 pm    Post subject:
Reply with quote

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

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Thu Mar 03, 2011 8:06 pm    Post subject: Reply to: JCL if else condition
Reply with quote

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

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Thu Mar 03, 2011 8:22 pm    Post subject:
Reply with quote

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

New User


Joined: 04 Jun 2010
Posts: 25
Location: Pune

PostPosted: Fri Mar 04, 2011 11:14 am    Post subject: JCL if else condition
Reply with quote

@ Phil && @ enrico icon_smile.gif 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. icon_rolleyes.gif
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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Mar 04, 2011 12:35 pm    Post subject: Reply to: JCL if else condition
Reply with quote

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

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Mar 04, 2011 2:27 pm    Post subject: Re: JCL if else condition
Reply with quote

RedDevil711 wrote:
@ Phil && @ enrico icon_smile.gif 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. icon_rolleyes.gif
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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Fri Mar 04, 2011 4:10 pm    Post subject:
Reply with quote

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

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Fri Mar 04, 2011 4:19 pm    Post subject: Re: JCL if else condition
Reply with quote

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

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts INCLUDE condition questions van bui DFSORT/ICETOOL 1 Thu Jun 30, 2016 9:52 am
No new posts 2 vsam file compare and update a fiel... ABINAYATHULASI DFSORT/ICETOOL 6 Sun May 29, 2016 11:15 am
No new posts File matching using specific condition mf_karthik DFSORT/ICETOOL 3 Fri Nov 20, 2015 11:04 pm
No new posts INCLUDE condition for 'Contains' krsenthil85 DFSORT/ICETOOL 4 Mon Oct 26, 2015 11:03 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us