IBM SC34-5764-01 User Manual
Page 6
![background image](/manuals/126838/6/background.png)
Chapter 4. Controlling the Flow within a program
. . . . . . . . . . . . . . . . . . . 33
Conditional, Looping, and Interrupt Instructions
. . . . . . . . . . . . . . . . . . . . . 33
Using Conditional Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
IF...THEN...ELSE Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Nested IF...THEN...ELSE Instructions . . . . . . . . . . . . . . . . . . . . . . . . 34
SELECT WHEN...OTHERWISE...END Instruction. . . . . . . . . . . . . . . . . . . . 37
Using Looping Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Repetitive Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Conditional Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Combining Types of Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Nested DO Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Using Interrupt Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
EXIT Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
CALL and RETURN Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . 49
SIGNAL Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Comparison Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Conversion Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Formatting Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
String Manipulating Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Miscellaneous Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Testing Input with Built-In Functions . . . . . . . . . . . . . . . . . . . . . . . . . 55
When to Write Subroutines Rather Than Functions . . . . . . . . . . . . . . . . . . . 57
Writing Subroutines and Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 58
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Receiving Information from a Subroutine or Function
. . . . . . . . . . . . . . . . . . 66
Subroutines and Functions—Similarities and Differences . . . . . . . . . . . . . . . . . . 70
. . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Using Compound Variables and Stems
. . . . . . . . . . . . . . . . . . . . . . . . 71
What Is a Compound Variable? . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Using Stems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Parsing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Parsing Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
More about Parsing into Words . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Parsing with Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Parsing Multiple Strings as Arguments . . . . . . . . . . . . . . . . . . . . . . . . 78
Using Quotations Marks in Commands
. . . . . . . . . . . . . . . . . . . . . . . 81
Using Variables in Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Calling Another REXX Program as a Command . . . . . . . . . . . . . . . . . . . . 82
Issuing Commands from a program . . . . . . . . . . . . . . . . . . . . . . . . . . 82
iv
CICS TS for VSE/ESA: REXX Guide