IBM SC34-5764-01 User Manual

Page 6

Advertising
background image

Tracing Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Exercises - Using the TRACE Instruction . . . . . . . . . . . . . . . . . . . . . . . 30

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

Chapter 5. Using Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
What is a Function?

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

Example of a Function

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

Built-In Functions

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

Arithmetic Functions

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

Comparison Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Conversion Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Formatting Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
String Manipulating Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Miscellaneous Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Testing Input with Built-In Functions . . . . . . . . . . . . . . . . . . . . . . . . . 55

Chapter 6. Writing Subroutines and Functions. . . . . . . . . . . . . . . . . . . . . 57
What are Subroutines and Functions? . . . . . . . . . . . . . . . . . . . . . . . . . 57

When to Write Subroutines Rather Than Functions . . . . . . . . . . . . . . . . . . . 57

Writing Subroutines and Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 58

When to Use Internal Versus External Subroutines or Functions . . . . . . . . . . . . . . 60
Passing Information

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

Receiving Information from a Subroutine or Function

. . . . . . . . . . . . . . . . . . 66

Subroutines and Functions—Similarities and Differences . . . . . . . . . . . . . . . . . . 70

Chapter 7. Manipulating Data

. . . . . . . . . . . . . . . . . . . . . . . . . . . 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

Chapter 8. Using Commands from a program . . . . . . . . . . . . . . . . . . . . . 81
Types of Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

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

Advertising