REXX
A readable scripting language for automation, tools and quick jobs on the mainframe.
Also written Restructured Extended Executor
Why it matters. When a task is too small for a COBOL program, a short REXX exec does it. Operators and engineers use it daily.
See it
The first line must be a comment. REXX uses it to recognise the language.
Syntax
EXEC 'dataset(member)' ['parameters'] [EXEC] SAY expression
- dataset(member)
- The library and the exec in it.
- 'parameters'
- Text passed to the exec as its argument.
- EXEC
- Tells TSO the member is REXX, if its first line has no /* REXX */ comment.
- SAY
- Show text.
Try it EXEC
- 1
In the exec HELLO, show the message HELLO FROM ZEDBANK.
REXX SAY 'HELLO FROM ZEDBANK' - 2
Run the exec HELLO from your DEV REXX library.
EXEC 'ZB0001.DEV.REXX(HELLO)'
Remember
- REXX is a script: you write a line, you run it, you see the result.
- SAY shows text. The text goes in quotes.
- EXEC 'library(member)' runs an exec. Start the member with a comment, /* REXX */, so TSO knows it is REXX.
The usual mistake
SAY Hello from ZedBank
Without quotes, REXX reads each word as a variable. A variable with no value gives its own name in capitals, so you get HELLO FROM ZEDBANK.
SAY 'Hello from ZedBank'
On real z/OS
MF/OS has its own REXX interpreter. A few TSO/E features are limited: OUTTRAP is missing, EXECIO tracks open and close only as a read position, and the data stack has one level. Other TSO commands run from an exec only in part.
Where can I practise REXX?
Right here, at ZedBank. You take a junior job at a simulated bank and use REXX in real work, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- REXX execA REXX program, stored as a member in a library and run by name from TSO or ISPF.
- PARSEREXX's instruction for pulling a string apart into pieces, by position, by delimiter or by pattern.
- Stem variableREXX's array, a variable with a dot in its name used to hold a list such as the lines of a file.
- TSO commandA command typed at a TSO prompt or on an ISPF command line to ask the system to do something directly.
- ISPFThe full-screen, menu-driven workbench most people use to do their day-to-day work on z/OS.