To protect elements on the data stack, you can create a new data stack with the
TSO/E REXX NEWSTACK command. Read the next section to see how the exec in
the previous example can safely issue an interactive TSO/E command.
To delete the new data stack and all elements in it, use the TSO/E REXX
DELSTACK command. Execs can create multiple stacks before deleting them.
Note: Before an exec returns to its caller, the called exec should issue a
DELSTACK command for each NEWSTACK command it issued, unless the
called exec intends for the caller to also use the new data stack.
Creating a New Data Stack with the NEWSTACK Command
The TSO/E REXX NEWSTACK command creates a private data stack that is
completely isolated from the original data stack. The elements on the original data
stack cannot be accessed by an exec or the routines that it calls until a DELSTACK
command is issued. When there are no more elements in the new data stack,
information is taken from the terminal.
Note: When you issue the NEWSTACK, it is your responsibility to issue a
corresponding DELSTACK command.
All elements added to the data stack after the NEWSTACK command are placed in
the new data stack. The original stack contains the elements placed on the stack
before the NEWSTACK command.
Instructions that could be used to create the illustrated new stack are as follows:
PUSH 'oldA'
PUSH 'old1'
'NEWSTACK'
QUEUE 'newY'
PUSH 'newX'
In the Example of an Interactive Command Error, the MAKEBUF command did not
protect the elements in the stack. If you substitute the NEWSTACK command for
the MAKEBUF command, the elements become inaccessible.
Protecting Elements in the Data Stack
148
z/OS V1R1.0 TSO/E REXX User’s Guide