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: 126
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: 992
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: 1226
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 cdoe to purge a JOB from spool a... Sulabh Agrawal CLIST & REXX 11 Thu Mar 09, 2017 11:36 am
No new posts Overriding PS data in rexx Shaheen Shaik CLIST & REXX 8 Fri Mar 03, 2017 5:08 pm
No new posts Joinkeys with condition scdinesh DFSORT/ICETOOL 10 Tue Feb 14, 2017 12:20 am
No new posts REXX compiled via RXTCOMP sergeyken CLIST & REXX 7 Tue Feb 07, 2017 9:41 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm


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