As shown in the following figure, the data stack that REXX uses combines the
techniques used in adding elements to stacks and queues. Elements can be placed
on the top or the bottom of a data stack. Removal of elements from the data stack,
however, occurs from the top of the stack only.
Manipulating the Data Stack
There are several REXX instructions that manipulate the data stack. Two
instructions add elements to the data stack and another removes elements from the
data stack.
Adding Elements to the Data Stack
You can store information on the data stack with two instructions, PUSH and
QUEUE.
PUSH - puts one item of data on the top of the data stack. There is virtually no
limit to the length of the data item.
elem1 = 'String 1 for the data stack'
PUSH elem1
QUEUE - puts one item of data on the bottom of the data stack. Again, there is
virtually no limit to the length of the data item.
elemA = 'String A for the data stack'
QUEUE elemA
If the two preceding sets of instructions were in an exec, the data stack would
appear as follows:
What is a Data Stack?
136
z/OS V1R1.0 TSO/E REXX User’s Guide