Example Using A Comparison Expression
/****************************** REXX *******************************/
/* This exec compares what you paid for lunch for two
*/
/* days in a row and then comments on the comparison.
*/
/*******************************************************************/
SAY 'What did you spend for lunch yesterday?'
SAY 'Please do not include the dollar sign.'
PARSE PULL last
SAY 'What did you spend for lunch today?'
SAY 'Please do not include the dollar sign.'
PARSE PULL lunch
IFlunch > last THEN
/* lunch cost increased */
SAY "Today's lunch cost more than yesterday's."
ELSE
/* lunch cost remained the same or decreased */
SAY "Today's lunch cost the same or less than yesterday's."
Exercises - Using Comparison Expressions
1. In the preceding example of using a comparison expression, what appears on
the screen when you respond to the prompts with the following lunch costs?
Yesterday’s Lunch
Today’s Lunch
4.42
3.75
3.50
3.50
3.75
4.42
2. What is the result (0 or 1) of the following expressions?
a.
″
Apples
″
=
″
Oranges
″
b.
″
Apples
″
=
″
Apples
″
c.
″
Apples
″
==
″
Apples
″
d. 100 = 1E2
e. 100 \= 1E2
f. 100 \== 1E2
ANSWERS
1. The following sentences appear.
a. Today’s lunch cost the same or less than yesterday’s.
b. Today’s lunch cost the same or less than yesterday’s.
c. Today’s lunch cost more than yesterday’s.
2. The expressions result in the following. Remember 0 is false and 1 is true.
a. 0
b. 1
c. 0 (The first
″
Apples
″
has a space.)
d. 1
e. 0
f. 1
Logical (Boolean) Operators
Logical expressions, like comparison expressions, return a true (1) or false (0) value
when processed. Logical operators combine two comparisons and return the true
(1) or false (0) value depending on the results of the comparisons.
Using Expressions
32
z/OS V1R1.0 TSO/E REXX User’s Guide
Summary of Contents for TSO/E REXX
Page 1: ...z OS TSO E REXX User s Guide SA22 7791 00 ...
Page 2: ......
Page 3: ...z OS TSO E REXX User s Guide SA22 7791 00 ...
Page 10: ...viii z OS V1R1 0 TSO E REXX User s Guide ...
Page 12: ...x z OS V1R1 0 TSO E REXX User s Guide ...
Page 14: ...xii z OS V1R1 0 TSO E REXX User s Guide ...
Page 18: ...xvi z OS V1R1 0 TSO E REXX User s Guide ...
Page 20: ...2 z OS V1R1 0 TSO E REXX User s Guide ...
Page 58: ...Tracing Expressions with the TRACE Instruction 40 z OS V1R1 0 TSO E REXX User s Guide ...
Page 78: ...60 z OS V1R1 0 TSO E REXX User s Guide ...
Page 86: ...Built In Functions 68 z OS V1R1 0 TSO E REXX User s Guide ...
Page 128: ...Issuing Other Types of Commands from an Exec 110 z OS V1R1 0 TSO E REXX User s Guide ...
Page 136: ...Debugging Execs 118 z OS V1R1 0 TSO E REXX User s Guide ...
Page 170: ...Protecting Elements in the Data Stack 152 z OS V1R1 0 TSO E REXX User s Guide ...
Page 201: ...Part 3 Appendixes Copyright IBM Corp 1988 2001 183 ...
Page 202: ...184 z OS V1R1 0 TSO E REXX User s Guide ...
Page 222: ...Using Variables 204 z OS V1R1 0 TSO E REXX User s Guide ...
Page 226: ...208 z OS V1R1 0 TSO E REXX User s Guide ...
Page 238: ...220 z OS V1R1 0 TSO E REXX User s Guide ...
Page 241: ......