Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
JCL SET WITH IF not working

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: JCL SET WITH IF not working
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    Post subject:
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

Site Director


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

PostPosted: Tue Apr 21, 2009 11:22 pm    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Wed Apr 22, 2009 12:24 am    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts LIBDEF not working in called proc packerm CLIST & REXX 0 Fri Sep 15, 2017 7:22 pm
No new posts Working with hex values in Filemanage... Emile Straker IBM Tools 0 Tue Sep 12, 2017 1:42 am
No new posts ISREDIT MACRO NOT WORKING! :cry: kirank889 TSO/ISPF 3 Thu Aug 03, 2017 5:46 pm
No new posts Restart=Step not working ALAK SAHA JCL & VSAM 6 Fri Jun 30, 2017 6:28 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us