|The American Programmer|
|Home||Programming||Books for Computer Professionals||Privacy||Terms|
|Home > Programming > REXX Language on TSO|
|Home > Programming > REXX Files > REXX Language on TSO|
The REXX Language on TSO. (Published August 2012) ISBN 1479104779
The book at Amazon.FR
The book at Amazon.GE
The book at Amazon.IT
The book at Amazon.ES
The book at Amazon.UK
Learn how to write programs in the REXX language for TSO, MVS, OS/390, Z/os.
My first book on the REXX programming language, is out of print. This is my second book on REXX for TSO.
It improves on REXX in the TSO Environment in every way: it clarifies important points, it is better organized, and gives better examples.
There are very few other books in print about REXX in the TSO Environment.
This book quickly gets you started writing programs in REXX for MVS, OS/390, Z/OS. It covers all REXX language elements, all TSO built-in functions, and the more important built-in functions.
Gabe Gargiulo is the author of several mainframe books:
REXX Quick Reference
REXX in the TSO Environment (Available new and used) MVS JCL (Out of Print)
Mastering OS2/REXX (Available new and used)
ISPF Services: Using the Dialogue Manager, with REXX
MVS/TSO (Available new and used)
Top of Page
Table of Contents REXX for TSO BookIntroduction 8
Chapter 1: Overview of REXX 11 REXX features 12 Different ways to execute a REXX program 13 Example of a REXX Program, with explanations 14
Chapter 2: Setting Up to Execute REXX in TSO/ISPF 17 1. Create a library 18 2. Specify details for allocating library 19 3. Create a member 19 4. Create the SETUP member in ISPF Editor 20 5. Execute the Setup Program 21 6. Try it 22
Chapter 3: The Basic Features 23 The initial comment 24 SAY - display on the terminal 25 Variables 26 Reserved variables 28 The Literal 30 The Label 32 PULL - accept input from the terminal 33 DO for looping 34 Concatenating Data Strings 35 EXIT to end your program 36 Passing commands to TSO 37 Short Description of all of REXX's Verbs or Keywords 38
Chapter 4: IF: the REXX conditional The simplest form of the IF 42 A few things to think about 44 Comparison operators 45 The DO END sequence 48 Boolean operators 50
Chapter 5: Looping: REXX repetition structure The simplest form 52 The simple DO...END sequence 53 The DO number ... END sequence 53 The DO variable ... END sequence 53 The DO that increments a variable 54 The DO WHILE 55 The DO UNTIL 55 The DO FOREVER 56 LEAVE 57 ITERATE: Skipping back to the top of the loop 58
Chapter 6: SELECT: the CASE Structure 59 Example 60 Points of syntax 60 Several instructions: example 61
Chapter 7: PARSE 63 The basic form of PARSE 64 Origins 65 The Action of PARSE 68 Short forms of PARSE 68 Uses of PARSE: ARG 69 The ARG in a main program 70 The ARG in a user-written function or subroutine 72 Uses of PARSE: PULL 73 Uses of PARSE: EXTERNAL 74 Uses of PARSE: VAR 75 Uses of PARSE: VALUE 76 Uses of PARSE: SOURCE 77 Uses of PARSE: VERSION 79 PARSE Templates: Just Variables 80 PARSE Templates: A Literal 83 PARSE Templates: A Variable in place of a Literal 85 PARSE Templates: Column Delimiting With Numbers 86
Chapter 8: Debugging 89 Interactive Debug 90 What you can do during Interactive Debug 90 Turning on Interactive Debug 91 Codes displayed during Interactive Debug 92 Tracing: the Smaller Guns 93 Combinations of the TRACE verb 94
Chapter 9: Trapping Unexpected Conditions 95 Situations you might want to trap 96 Trapping Unexpected Conditions: General 97 The trap that terminates 97 The trap that continues 97 Changing the name of the trap 98 Trapping Unexpected Conditions: Syntax 99 Trapping Unexpected Conditions: Error 100 Trapping Unexpected Conditions: Failure 102 Trapping Unexpected Conditions: Novalue 103 Trapping Unexpected Conditions: Halt 104 Trapping Unexpected Conditions: Contents of the Trap 105
Chapter 10: SIGNAL: the Extinct “GO TO” 107 Signal: go there (but don’t come back) 108
Chapter 11: Math 111 When does REXX do math? 112 Math: Arithmetic Operators 113 Math: Precision 114
Chapter 12: Passing Commands to Command Processors 115 Passing commands to the environment 116 How Do You Get REXX to Pass a Command to a Command Processor? 117 What Do the Return Codes (RC) mean? 118 What Command Processors Are Out There? 120 How do You Send Commands to a Command Processor? 121 Sending commands to TSO 121 Sending commands to ISPF 122 Sending commands to the ISPF Editor 124 How Does Your Program Know if the Command Processor is There? 126
Chapter 13: Built-in Functions 127 Some examples 128 Basics of functions 128 CALLing a function 129 Some of the more important functions. 130 Those Conversion Functions 132 Built-in Functions: TSO Functions 134
Chapter 14: Writing Your Own Functions 139 Example of Internal Function 140 Internal, user-written functions 140 What makes a function a function? 142 Protecting Variables 143 Example of External Function 144 External, user-written functions 144 Search Order for Functions and Subroutines 145
Chapter 15: Writing Your Own Subroutines 147 Example 148 Writing internal subroutines 148
Chapter 16: The Internal Data Queue, or Stack 149 What is it? 150 How do you put things into the Data Queue 150 Data Queue or terminal dialogue? 151 Functions used with the Data Queue 152 Leftovers 153 Clean up after yourself 153
Chapter 17: Compound Variables 155 Compared to traditional subscripted variables 156 Understanding compound variables 157 Examples 158
Chapter 18: Reading and Writing Files: EXECIO 161 The Basics 162 The ALLOCATE command for reading 163 Reading with EXECIO 164 Reading whole file with EXECIO into Data Queue – example 165 Reading one record at a time into Data Queue – example 166 Reading whole file with EXECIO into an array – example 167 Additional options for Reading 168 The ALLOCATE command for writing 169 Writing with EXECIO 170 Writing whole file from Data Queue – example 171 Writing whole file from an array - example 172
Chapter 19: The INTERPRET Instruction 175 Why INTERPRET? 176
Chapter 20: Running REXX in Batch 179 Example 180
Sample Pages (formatting not same as in the book)
(This is a part of the chapter) 11: Math
If Einstein had had REXX he would have been twice the genius he was. (Or would he have been creating video games...). REXX does math to whatever precision you desire, limited only by the amount of computer memory you have available. REXX does everything in decimal numbers so you won't see approximate results.
Changing the precision.
The default precision is 9 digits. If a calculation generates more significant digits than that, REXX will round the answer and stop at 9 digits. You can change the precision to 100 or 1000 or 10000! On some systems you can go much higher than that. Useful for figuring your income tax.....
To change the precision to 100 digits:
NUMERIC DIGITS 100
The following example will show you what that means.
SAY 2 / 3
/*displays .666666667 (9 digits) */
NUMERIC DIGITS 100
SAY 2 / 3
Do Practice Problems 35 - 38.
15: Writing Your Own Subroutines
/* REXX */
/* instructions */
/* instructions */
/* instructions */
ANSWER = NUM1 + NUM2
Writing internal subroutines
An internal subroutine is used to simplify coding - to avoid long cumbersome logic structures. I strongly encourage their use.
A subroutine looks like a function, but it's not a function.
Here are the characteristics of a subroutine:
- invoked by: CALL subroutine-name
- Example: CALL ADDEM
- ARG is optional
- RETURN is required but you don't have to pass information back on it
- variables are generally shared with the main part of the program
- there are no external subroutines in REXX.
Do Practice Problems 48 - 52.
Top of Page
Practice problems and suggested answers that go with the book. View as web page
REXX Manuals from IBM
TSO Line Mode (Native TSO) commands. (such as DELETE, HRECALL, ALLOCATE, Line Mode EDIT) Essential for REXX and CLIST programmers
Writing ISPF Editor Macros in REXX
More information on setting up to use REXX on TSO
CLIST and REXX
REXX on VM/CMS
My REXX Quick Reference Book
REXX Error Codes
2 Expression > 64000 characters (OS/2 only)
3 Program is unreadable
4 Program interrupted
5 Machine storage exhausted
6 Unmatched /* or quote
7 WHEN or OTHERWISE expected
8 Unexpected THEN or ELSE
9 Unexpected WHEN or OTHERWISE
10 Unexpected or unmatched END
11 Control stack full
12 Clause > 500 characters
13 Invalid character in data
14 Incomplete DO/SELECT/IF
15 Invalid hex constant
16 Label not found
17 Unexpected PROCEDURE
18 THEN expected
19 String or symbol expected
20 Symbol expected
21 Invalid data on end of clause
22 Invalid character string
23 Invalid SBCS/DBCS mixed string
24 Invalid trace request
25 Invalid subkeyword found
26 Invalid whole number
27 Invalid do syntax
28 Invalid LEAVE or ITERATE
29 Environment name too long
30 Name or string > 250 characters
31 Name starts with numeric or "."
32 Invalid use of stem
33 Invalid expression result
34 Logical value not 0 or 1
35 Invalid expression
36 Unmatched "(" in expression
37 Unexpected "," or ")"
38 Invalid template or pattern
39 Evaluation stack overflow
40 Incorrect call to routine
41 Bad arithmetic conversion
42 Arithmetic overflow/underflow
43 Routine not found
44 Function did not return data
45 No data specified on function return
46 Invalid variable reference
48 Failure in system service
49 Interpreter failure
This book will get you into programming with Classic REXX (Restructured eXtended eXecutor language) on IBM's mainframe running MVS, OS390 or Zos TSO/ISPF. You can run REXX online during a TSO session, or in a batch program with JCL.
REXX is a user-friendly interpreted scripting language developed by Michael Cowlishaw. It uses clear English-language verbs and parameters.
REXX is used for application prototyping and one-time jobs. REXX is generally interpreted and so there is a performance penalty.
REXX is used as the driver script for developing and running ISPF applications.
Your email and other personal information will not be given to anyone and will be used only to communicate with you about your order.
| Home | Programming | Books for Computer Professionals | Privacy | Terms | Contact |
| Site Map and Site Search | Programming Manuals and Tutorials | The REXX Files | Top of Page |