Learning the REXX Language
The REXX language is a versatile general-purpose programming language
that can be used by new and experienced programmers. This part of
the book is for programmers who want to learn the REXX language.
The chapters
in this part cover the following topics.
- Introduction — The REXX language has many features that make it a powerful programming tool.
- Writing and Running a REXX Exec — Execs are easy to write and have few syntax rules.
- Using Variables and Expressions — Variables, expressions, and operators are essential when writing execs that do arithmetic and comparisons.
- Controlling the Flow Within an Exec — You can use instructions to branch, loop, or interrupt the flow of an exec.
- Using Functions — A function is a sequence of instructions that can perform a specific task and must return a value.
- Writing Subroutines and Functions — You can write internal and external routines that are called by an exec.
- Manipulating Data — Compound variables and parsing are two ways to manipulate data.
Note: Although you can write a REXX exec to run in a non-TSO/E address
space in MVS™, the chapters
and examples in this part assume the exec will run in a TSO/E address
space. If you want to write execs that run outside of a TSO/E address
space, keep in mind the following exceptions to information in Part
1:
- An exec that runs outside of TSO/E cannot include TSO/E commands, unless you use the TSO/E environment service (see note).
- In TSO/E, several REXX instructions either display information
on the terminal or retrieve information that the user enters at the
terminal. In a non-TSO/E address space, these instructions get information
from the input stream and write information to the output stream.
- SAY — this instruction sends information to the output DD whose default is SYSTSPRT.
- PULL — this instruction gets information from the input DD whose default is SYSTSIN.
- TRACE — this instruction sends information to the output DD whose default is SYSTSPRT.
- PARSE EXTERNAL — this instruction gets information from the input DD whose default is SYSTSIN.
- The USERID built-in function, instead of returning a user identifier, might return a stepname or jobname.
Note: You can use the TSO/E environment service, IKJTSOEV, to
create a TSO/E environment in a non-TSO/E address space. If you run a REXX exec in the TSO/E
environment you created, the exec can contain TSO/E commands, external functions, and services that
an exec running in a TSO/E address space can use. That is, the TSO host command environment (ADDRESS
TSO) is available to the exec. For more information about the TSO/E environment service and the different considerations for running
REXX execs within the environment, see z/OS TSO/E Programming Services.