View previous topic :: View next topic |
Author |
Message |
JCLGuy Beginner

Joined: 29 Jan 2010 Posts: 4 Topics: 2
|
Posted: Sat Jan 30, 2010 3:41 am Post subject: IF/THEN statement |
|
|
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 |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Sat Jan 30, 2010 10:18 am Post subject: |
|
|
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 |
|
 |
JCLGuy Beginner

Joined: 29 Jan 2010 Posts: 4 Topics: 2
|
Posted: Sat Jan 30, 2010 11:28 am Post subject: |
|
|
Hi,
Thaks for your reply.
Now I got it.
Josef. |
|
Back to top |
|
 |
|
|