IF ((season = 'winter') | (snowing ='yes')) & (broken_leg ='no') THEN
\______________/ \____________/ \_____________/
false true true
\___________________/ /
true /
\_____________________________/
true
As a result, when you run the exec, you see the message:
Go skiing.
Exercises - Using Logical Expressions
A student applying to colleges has decided to pick ones according to the following
specifications:
IF (inexpensive | scholarship) & (reputable | nearby) THEN
SAY "I'll consider it."
ELSE
SAY "Forget it!"
A college is inexpensive, did not offer a scholarship, is reputable, but is over 1000
miles away. Should the student apply?
ANSWER
Yes. The conditional instruction works out as follows:
IF (inexpensive | scholarship) & (reputable | nearby) THEN ...
\___________/ \___________/ \_________/ \______/
true false true false
\___________/ \_________/
true true
\_________________________/
true
Concatenation Operators
Concatenation operators combine two terms into one. The terms can be strings,
variables, expressions, or constants. Concatenation can be significant in formatting
output.
The operators that indicate how to join two terms are as follows:
Operator Meaning
blank Concatenate terms and place one blank in between. Terms that are
separated by more than one blank default to one blank when read.
For example:
SAY true blue /* result is TRUE BLUE */
|| Concatenate terms and place no blanks in between. For example:
(8 / 2)||(3 * 3) /* result is 49 */
abuttal Concatenate terms and place no blanks in between. For example:
per_cent'%' /* if per_cent = 50, result is 50% */
Using Concatenation Operators
One way to format output is to use variables and concatenation operators as in the
following example. A more sophisticated way to format information is with parsing
and templates. Information about parsing appears in “Parsing Data” on page 87.
Using Expressions
34
z/OS V1R1.0 TSO/E REXX User’s Guide