z/OS TSO/E REXX User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Protecting Elements in the Data Stack

z/OS TSO/E REXX User's Guide
SA32-0982-00

In certain environments, particularly MVS™, where multiple tasks run at the same time, it is often important for an exec to isolate stack elements from other execs.

Similarly, an exec in TSO/E might want to protect stack elements from a routine (subroutine or function) that it calls. For example, if an exec puts elements on the data stack for its own use and then calls a subroutine that issues an interactive TSO/E command, such as ALLOCATE, the command goes to the data stack first for input to the command. Because the stack input is incorrect for the command prompt, the exec ends in error.

Example of an Interactive Command Error

EXEC1

PUSH prompt1
PUSH prompt2
CALL sub1
7invellip.
EXIT

SUB1:

'MAKEBUF'
'ALLOCATE'
⋮

Even though the subroutine in the preceding example starts with the MAKEBUF command, the stack elements will be used because MAKEBUF does not protect elements previously placed on the stack.

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.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014