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

How Can we set OR condition in rexx


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 128
Location: UK

PostPosted: Fri Jun 12, 2009 1:22 pm
Reply with quote

Hello Friends,

How can we check OR condition in REXX. Requirement is like this

REXX
For e.g
Say "ENTER WAREHOUSE NAME"
Parse PULL Wh_ipt
Here i want to check if Wh_ipt = T or X or Z

proceed other wise send msg to enter the WAREHOUSE NAME again

Regards
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Fri Jun 12, 2009 1:25 pm
Reply with quote

Use the defined 'or'symbol - usually ' |' (vertical bar),
Code:
if  (Wh_ipt = T | Wh_ipt = X | Wh_ipt = Z)


Garry .
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Fri Jun 12, 2009 10:14 pm
Reply with quote

When I need 3 or more ORs, I prefer to use:
Code:
/* assuming T, X, Z, Y and R are variables containing warehouse names */
if WordPos(Wh_ipt,T X Z Y R) <> 0
or
Code:
/* assuming T, X, Z, Y and R are warehouse names */
if WordPos(Wh_ipt,'T X Z Y R') <> 0


A note about your PULL: if you are reading your input from a file (in batch, for example),
variable Wh_ipt will have a lot of extra spaces on the right (up to the record length, almost certainly 80).
You can prevent that by doing:
Code:
/* assuming you expect only ONE WORD  */
Parse PULL Wh_ipt .
or
Code:
/* assuming you expect MORE THAN ONE WORD  */
Parse PULL Wh_ipt
Wh_ipt = Strip(Wh_ipt)
For example, extra spaces in the DSNAME parameter is a cause of failure in ALLOC statements, .
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top