Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How Can we set OR condition in rexx

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: How Can we set OR condition in rexx
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

Active Member


Joined: 08 May 2006
Posts: 995
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Fri Jun 12, 2009 1:25 pm    Post subject:
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: 1232
Location: Israel

PostPosted: Fri Jun 12, 2009 10:14 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts REXX to get the all datasets name parasmalik20 CLIST & REXX 5 Tue Jul 18, 2017 9:10 pm
No new posts How system know which REXX to excute? jackzhang75 CLIST & REXX 14 Thu Jul 06, 2017 1:09 am
No new posts REXX - Dynamic file Creation d_sarlie CLIST & REXX 7 Tue Jun 27, 2017 7:30 pm
No new posts REXX WTO for console message bipinpeter CLIST & REXX 6 Tue Jun 27, 2017 3:56 pm
No new posts Convert CLIST to REXX cvnlynn CLIST & REXX 12 Tue Jun 27, 2017 2:06 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us