z/OS TSO/E REXX Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


QSTACK

z/OS TSO/E REXX Reference
SA32-0972-00

Read syntax diagramSkip visual syntax diagram
>>-QSTACK------------------------------------------------------><

queries the number of data stacks in existence for an exec that is running. QSTACK returns the number of data stacks in the REXX special variable RC. The value QSTACK returns indicates the total number of data stacks, including the original data stack. If you have not issued a NEWSTACK command to create a new data stack, QSTACK returns 1 in the special variable RC for the original data stack.

You can use the QSTACK command in REXX execs that run in both the TSO/E address space and in non-TSO/E address spaces.

QSTACK returns the current number of data stacks created by an exec and by other routines (functions and subroutines) the exec calls. You can issue QSTACK from the calling exec or from a called routine. For example, if an exec issues one NEWSTACK command and then calls a routine that issues another NEWSTACK command, and none of the new data stacks are deleted with the DELSTACK command, QSTACK returns 3 in the REXX special variable RC.

The following table shows how QSTACK sets the REXX special variable RC.

Return code Meaning
0 No data stack exists. See Data stack routine.
1 Only the original data stack exists
2 One new data stack and the original data stack exist
3 Two new data stacks and the original data stack exist
n n - 1 new data stacks and the original data stack exist

Examples

  1. Suppose an exec creates two new data stacks using the NEWSTACK command and then deletes one data stack using the DELSTACK command. If the exec issues the QSTACK command, QSTACK returns 2 in the REXX special variable RC.
    "NEWSTACK"    /* data stack 2 created */
    ⋮
    "NEWSTACK"    /* data stack 3 created */
    ⋮
    "DELSTACK"    /* data stack 3 deleted */
    "QSTACK"
    SAY 'The number of data stacks is' RC   /* RC = 2 */
  2. Suppose an exec creates one new data stack and then calls a routine that also creates a new data stack. The called routine then calls another routine that creates two new data stacks. When either of the called routines or the original exec issues the QSTACK command, QSTACK returns 5 in the REXX special variable RC. The data stack that is active is data stack 5.
    "NEWSTACK"  /* data stack 2 created */
    CALL sub1
    "QSTACK"
    SAY 'Data stacks =' RC  /* RC = 5 */
    EXIT
    
    sub1:
    "NEWSTACK"  /* data stack 3 created */
    CALL sub2
    "QSTACK"
    SAY 'Data stacks =' RC   /* RC = 5 */
    RETURN
    
    sub2:
    "NEWSTACK"  /* data stack 4 created */
    ⋮
    "NEWSTACK"  /* data stack 5 created */
    "QSTACK"
    SAY 'Data stacks =' RC  /* RC = 5 */
    RETURN

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014