v Exponential operation
IF (8 > 7**2) & (2 < 3) | (8||2 = 10) THEN ...
\____/
49
v Concatenation operation
IF (8 > 49) & (2 < 3) | (8||2 = 10) THEN ...
\____/
82
3. Compute all operations within parentheses from left to right
IF (8 > 49) & (2 < 3) | (82 = 10) THEN ...
\____/ \___/ \_____/
01 0
4. Logical AND
0&1| 0
\_______/
0
5. Inclusive OR
0|0
\_____________/
0
Exercises - Priority of Operators
1. What are the answers to the following examples?
a. 22 + (12 * 1)
b. -6/-2>(45%7/2)-1
c. 10*2-(5+1)//5*2+15-1
2. In the example of the student and the college from “Exercises - Using Logical
Expressions” on page 34, if the parentheses were removed from the student’s
formula, what would be the outcome for the college?
IF inexpensive | scholarship & reputable | nearby THEN
SAY "I'll consider it."
ELSE
SAY "Forget it!"
Remember the college is inexpensive, did not offer a scholarship, is reputable,
but is 1000 miles away.
ANSWERS
1. The results are as follows:
a. 34 (22 + 12 = 34)
b. 1 (true) (3>3-1)
c. 32 (20-2+15-1)
2. I’ll consider it.
The & operator has priority, as follows, but the outcome is the same as the
previous version with the parentheses.
IF inexpensive | scholarship & reputable | nearby THEN
\_________/ \_________/ \_______/ \____/
true false true false
\ \___________/ /
\ false /
\_________________/ /
true /
\____________________/
true
Using Expressions
36
z/OS V1R1.0 TSO/E REXX User’s Guide