Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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

Senior Member


Joined: 08 May 2006
Posts: 1002
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: 1250
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 Looping REXX - unable to interrupt RAVISANKAR07 CLIST & REXX 3 Wed Dec 06, 2017 1:08 pm
No new posts The same REXX program doesnt work for... jackzhang75 CLIST & REXX 5 Wed Dec 06, 2017 2:51 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
This topic is locked: you cannot edit posts or make replies. Rexx to Grab ISMF Information. upendrasri All Other Mainframe Topics 16 Sun Nov 26, 2017 12:35 am
No new posts Rexx to send an email without SMTP Se... upendrasri All Other Mainframe Topics 12 Sun Nov 19, 2017 7:59 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us