Use the SWAPSTAK() function to create and switch between multiple numbered stacks. Once a stack is made current by the SWAPSTAK() function, all native REXX and TSO/E emulation stack commands operate normally.
The SWAPSTAK() function has this syntax:
stack = SWAPSTAK([n|NEW|DELETE])
The SWAPSTAK() function takes these arguments:
|
stack |
Error text is returned if the operation is not successful. Otherwise, the current stack number is returned. |
|
n |
Desired stack number. You can specify any number between 0 and 231-1. If the specified stack does not exist, it is created. Although the total number of stacks that an IMOD can maintain is limited only by available memory, large numbers of stacks (over 25, for example) compromise stack-switching efficiency. |
|
NEW |
Beginning with stack 0, examines each stack until one is found that has a status of "never-used" (the status of a stack that has never been referenced, a stack that has been explicitly destroyed with a SWAPSTAK(DELETE) operation). This stack is then assigned a status of "empty" and it is made the current stack. This is useful for subroutines that desire a temporary workspace. |
|
DELETE |
Deletes the currently accessed stack and returns it to "never-used" status. Stack 0 becomes the current stack. If you delete stack 0, it is automatically recreated as an empty stack. |
The SWAPSTAK() function produces these return codes:
|
101 |
ARG 1 MISSING OR INVALID |
Example
/* This code segment can be used to obtain a work stack */
ostack = swapstak( ) /* Save current stack number */
x = swapstak('new') /* Obtain new stack for workspace */
x = swapstak('delete') /* Delete workspace stack */
x = swapstak(ostack) /* Restore original stack number */
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |