Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Coding of Logical OR in TSO REXX

Status
Not open for further replies.

JohnCorbin

Programmer
Jan 16, 2005
2
CA
Hi gang...

If I have code like

SELECT
WHEN code ='A' | CODE = 'B' | CODE = 'C' THEN
more code here
OTHERWISE
more code here
END
does the line code ='A' | CODE = 'B' | CODE = 'C'

read the same as code ='A' or CODE = 'B' or CODE = 'C'

Is there another way to code this ... I was thinking of


SELECT
WHEN code = 'A' THEN
WHEN code = 'B' THEN
WHEN code = 'C' THEN
more code here
OTHERWISE
more code here
END
 
Yes, the | is an or.

Just bear in mind that if you code;

WHEN code = 'A' | code = 'B' | code = 'C'

then your program is always doing 3 variable comparisons.

I prefer to minimise my comparisons by coding things like;

if index('A B C', code) > 0 then ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top