Specifying Values when Invoking an Exec ..............22
Preventing Translation of Input to Uppercase .............23
Passing Arguments ......................24
Chapter 3. Using Variables and Expressions .............25
Using Variables.........................25
Variable Names .......................26
Variable Values ........................27
Exercises - Identifying Valid Variable Names .............27
Using Expressions .......................28
Arithmetic Operators ......................28
Comparison Operators .....................30
Logical (Boolean) Operators ...................32
Concatenation Operators ....................34
Priority of Operators ......................35
Tracing Expressions with the TRACE Instruction ............37
Tracing Operations ......................37
Tracing Results........................38
Chapter 4. Controlling the Flow Within an Exec ............41
Using Conditional Instructions ...................42
IF/THEN/ELSE Instructions ...................42
Nested IF/THEN/ELSE Instructions ................43
SELECT/WHEN/OTHERWISE/END Instruction ............44
Using Looping Instructions ....................47
Repetitive Loops .......................47
Conditional Loops .......................52
Combining Types of Loops ...................55
Nested DO Loops .......................55
Using Interrupt Instructions ....................56
EXIT Instruction .......................57
CALL/RETURN Instructions ...................57
SIGNAL Instruction ......................58
Chapter 5. Using Functions ...................61
What is a Function? .......................61
Example of a Function .....................62
Built-In Functions ........................63
Arithmetic Functions ......................63
Comparison Functions .....................63
Conversion Functions .....................64
Formatting Functions......................64
String Manipulating Functions ..................64
Miscellaneous Functions ....................65
Testing Input with Built-In Functions ................66
Chapter 6. Writing Subroutines and Functions ............69
What are Subroutines and Functions? ................69
When to Write Subroutines vs. Functions ...............70
Writing a Subroutine .......................70
Passing Information to a Subroutine ................72
Receiving Information from a Subroutine ..............75
Writing a Function........................77
Passing Information to a Function .................79
Receiving Information from a Function ...............83
Summary of Subroutines and Functions................83
iv z/OS V1R1.0 TSO/E REXX User’s Guide