MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

IF/THEN statement

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
JCLGuy
Beginner


Joined: 29 Jan 2010
Posts: 4
Topics: 2

PostPosted: Sat Jan 30, 2010 3:41 am    Post subject: IF/THEN statement Reply with quote

Hi,
I have one procedure which uses a file accordingly to a SET parameter and also has an IF/THEN statements in it.
An IF/THEN statements appears in the Job card as well.
The problem is that when the second part of the IF/THEN going to be execute the procedure will not operate as expected. ( it will enter the ELSE part in the procedure )
So I need some alternatives for it without changing the procedure.
My code, for example is :
...
Code:

// SET DAY=%%DD
//*
// SET FILE1=X,
//       FILE2=Y
//*
//PROC1 PROC
//*
//S1 EXEC PGM=IEFBR14
//S2 do something here..
//  IF PROC1.S2.RC=0 THEN
// ..
//  ELSE
// ..
// ENDIF
//*
//           PEND
//*
// IF &DAY=1 THEN
//EX1 EXEC PROC1,FILE=&FILE1
// ENDIF
//*
// IF &DAY GE 2 THEN
//EX2 EXEC PROC1,FILE=&FILE2
// ENDIF
//


Thanks for help !
Josef
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Sat Jan 30, 2010 10:18 am    Post subject: Reply with quote

IF/THEN/ELSE allows for conditional processing based on a limited set of pre-defined relational expression keywords. Those keywords are:

RC (Return Code)
ABEND (Abend condition has occured)
ABENDCC (System or user Abend Code)
RUN (Step started execution)

You're NOT allowed to create your own relational expressions.

To fix your problem, you need to pass the value of &DAY as a parameter to a program, and then have that program set an appropriate Return-Code value, at which time your IF/THEN/ELSE logic can properly check for the value of RC and take the appropriate course of action.
Back to top
View user's profile Send private message
JCLGuy
Beginner


Joined: 29 Jan 2010
Posts: 4
Topics: 2

PostPosted: Sat Jan 30, 2010 11:28 am    Post subject: Reply with quote

Hi,
Thaks for your reply.
Now I got it. bonk

Josef.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group