IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

JCL SET WITH IF not working


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
aakar

New User


Joined: 08 Apr 2008
Posts: 36
Location: mumbai

PostPosted: Tue Apr 21, 2009 11:03 pm
Reply with quote

Based on a return code from a Particular Proc step am trying to decide a dataset qualifier in the next proc step as follows:

Job step1 :
PS1
PS2 : RC = 0
PS3
PS4

Have given the following SET command as far as :
//JSET1 IF (JS1.PS2.RC = 0) THEN
// SET PPGM3=ABCD
//JSET1EL ELSE
// SET PPGM3=EFGH
//JSET1EN END IF

Job step2 :
PS1
PS2 : Where the dataset is being used, as XXXX.YYY.&PPGM3..FILE in DISP=SHR
PS3
PS4

When JS1.PS2.RC gives 0 , as per the JCL it should give a value 'ABCD' to PPGM3 but it is always giving a value of 'EFGH' instead, irrespective of what is the value of JS1.PS2.RC.

The symbolic varaiable has not been in the proc but has not been assigned any value in the procedure.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Apr 21, 2009 11:22 pm
Reply with quote

The IF THEN ELSE ENDIF structure can only be used to control the execution of steps. The &PPGM3 is resolved at the time the jcl is submitted before any steps are executed. Set up two PS2 steps (PS2A AND PS2B) one with each version of the dsn and use the IF THEN ELSE ENDIF structure to control which one will be executed.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Apr 21, 2009 11:22 pm
Reply with quote

Hello,

Instead of trying to determine what we need to see, you should post all of the relevant info.

Post your jcl as well as the expanded jcl from an execution.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Apr 22, 2009 12:24 am
Reply with quote

Craq Giegerich wrote:
The IF THEN ELSE ENDIF structure can only be used to control the execution of steps. The &PPGM3 is resolved at the time the jcl is submitted before any steps are executed.
Does that means that if the set were done in two different steps and the second step was skipped, the second set would be in force anyway?
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Wed Apr 22, 2009 12:28 am
Reply with quote

Quote:
Does that means that if the set were done in two different steps and the second step was skipped, the second set would be in force anyway?
Yes
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Apr 22, 2009 1:23 am
Reply with quote

The set statement is processed unconditionally when the jcl is interpreted before any steps are executed. If you have a job stream with a set at the beginning and another set in the middle for the same variable but a different value then that parameter will have a different value in different steps.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts ICETOOL with JOINKEY for Big record l... DFSORT/ICETOOL 12
No new posts JCL JOB Cancel/Purge Not Working JCL & VSAM 6
No new posts OMVS Shell Script not working properly. All Other Mainframe Topics 1
Search our Forums:

Back to Top