A script always has one Data stack. It has a name, which is usually "SESSION" (although may not be). This is the stack which is used by default when a script starts.

But some interpreters, such as Reginald, allow a script to create additional stacks. Indeed, a script could have numerous stacks all existing simultaneously.

Only one stack can be active at a time. The other stacks can contain data items, but a script can set only one stack as the "current stack". The PUSH, QUEUE, PULL, and PARSE PULL instructions operate upon the current stack (as does QUEUED(), and other, built-in functions).

You use the RXQUEUE built-in's 'C' option to create another stack. Each stack must have a unique name. (No two stacks can have the same name). You can supply the name you desire for this new stack, or let REXX create a unique name for you. (If the name you supply happens to already be used by another stack, then REXX will create a unique name for you regardless).

If RXQUEUE() succeeds in creating this new stack, it will return the final name of the stack, upper-cased. RXQUEUE() will also set this as the current stack. If there is a problem, RXQUEUE() will instead return an empty string.

For example, here we create a new stack named "MY STACK", and then PUSH/PULL an item in it:

/* Create the "MY STACK" stack */
stackname = RXQUEUE('C', 'MY STACK')
IF stackname \= "" THEN DO

   /* Push the item "Some data" */
   PUSH "Some data"

   /* Remove that item from the stack and
    * store it in a variable named "data"
    */
   PARSE PULL data

END
You should delete a stack when you're all done using it. You use RXQUEUE()'s 'D' option to do this. You need to pass the name of the stack that RXQUEUE() returned when you created the stack. RXQUEUE() will return 0 if the stack is successfully deleted, or non-zero otherwise. (RXQUEUE() will also delete any items still remaining in that stack).
/* Delete the "MY STACK" stack */
result = RXQUEUE('D', stackname)
IF result \= 0 THEN SAY 'Error deleting "' || stackname || '" Data stack!'
If you have several stacks, you can use RXQUEUE()'s 'S' option to set which stack you'd like as the current stack. You can change which stack is the current one whenever you desire. Also, RXQUEUE()'s 'G' option can be used to retrieve the name of the current stack. This will return an empty string if there is an error.
/* Get the name of the default stack */
defstack = RXQUEUE('G')

/* Create the "MY STACK" stack and set it as current */
stackname = RXQUEUE('C', 'MY STACK')
IF stackname \= "" THEN DO

   /* Push the item "Some data" */
   PUSH "Some data"

   /* Remove that item from the stack and
    * store it in a variable named "data"
    */
   PARSE PULL data

   /* Set the original stack as current */
   IF RXQUEUE('S', defstack) = "" THEN SAY "Error restoring original stack"

   /* Delete the "MY STACK" stack */
   result = RXQUEUE('D', stackname)
   IF result \= 0 THEN SAY 'Error deleting "' || stackname || '" Data stack!'
END