Data stack
A list of lines that a REXX exec can add to and read from, used to pass data between an exec, commands and other execs.
Also written REXX stack, PUSH, QUEUE, PULL, QUEUED, NEWSTACK
The data stack is a list of lines that REXX keeps for an exec. QUEUE adds a line to the bottom, so lines come out in the order they went in. PUSH adds a line to the top, so the last one in comes out first. PULL takes the next line off the stack. The QUEUED() function says how many lines are waiting.
The stack is a simple way to pass data around. EXECIO can read a file onto the stack instead of into a stem, and some TSO commands read their input from it. One exec can leave lines for another exec it calls.
PULL has a surprise: if the stack is empty, it waits for the user to type a line instead. In a batch job, that may read from the input or end with an error. And PULL changes the text to upper case, unlike PARSE PULL.
The bigger surprise is what happens to leftovers. Under TSO, any lines still on the stack when the exec ends are read by TSO as commands. To avoid that, empty the stack before ending, or use NEWSTACK and DELSTACK to keep your own lines separate.
Where can I learn this hands-on?
Right here, at ZedBank. You take a junior job at a simulated bank and learn each part of the work by doing it, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- REXXA readable scripting language used across the mainframe for automation, tooling and quick one-off tasks.
- EXECIOThe REXX command for reading records from a dataset, or writing records to one, under TSO.
- PARSEREXX's instruction for pulling a string apart into pieces, by position, by delimiter or by pattern.
- REXX execA REXX program, stored as a member in a library and run by name from TSO or ISPF.
- OUTTRAPA REXX function that captures the output of TSO commands into a stem variable, so the exec can read it.