To prevent a routine from accessing elements below the buffer, you can use the
QUEUED built-in function as follows:
olditems = QUEUED()
'MAKEBUF'
PUSH ...
QUEUE ...
DO WHILE QUEUED() > olditems /* total items > old number of items */
PULL ....
...
END
'DROPBUF'
Dropping a Buffer with the DROPBUF Command
When an exec has no more need for a buffer on the data stack, it can use the
TSO/E REXX DROPBUF command to remove the buffer (and its contents). The
DROPBUF command removes the most recently created buffer.
To drop a specific buffer on the data stack and all buffers created after it, issue the
DROPBUF command with the number of the buffer. The first MAKEBUF creates
buffer 1, the second creates buffer 2, and so on. For example, if an exec issued
three MAKEBUF commands that created three buffers, when you issue DROPBUF
2, the second and third buffers and all elements within them are removed.
To remove all elements from the entire data stack including elements placed on the
data stack before buffers were added, issue DROPBUF 0. DROPBUF 0 creates an
empty data stack and should be used with caution.
Note:
When an element is removed below a buffer, the buffer disappears. Thus
when elements are unintentionally removed below a buffer, the
corresponding DROPBUF command might remove the incorrect buffer and
its elements. To prevent an exec from removing elements below a buffer, use
the QUEUED built-in function or use the NEWSTACK command as
described in “Protecting Elements in the Data Stack” on page 147.
Finding the Number of Buffers with the QBUF Command
To find out how many buffers were created with the MAKEBUF command, use the
TSO/E REXX QBUF command. QBUF returns in the REXX special variable RC, the
number of buffers created.
'MAKEBUF'
..
.
'MAKEBUF'
..
.
'QBUF'
SAY 'The number of buffers is' RC
/* RC = 2 */
Creating a Buffer on the Data Stack
144
z/OS V1R1.0 TSO/E REXX User’s Guide
Summary of Contents for TSO/E REXX
Page 1: ...z OS TSO E REXX User s Guide SA22 7791 00 ...
Page 2: ......
Page 3: ...z OS TSO E REXX User s Guide SA22 7791 00 ...
Page 10: ...viii z OS V1R1 0 TSO E REXX User s Guide ...
Page 12: ...x z OS V1R1 0 TSO E REXX User s Guide ...
Page 14: ...xii z OS V1R1 0 TSO E REXX User s Guide ...
Page 18: ...xvi z OS V1R1 0 TSO E REXX User s Guide ...
Page 20: ...2 z OS V1R1 0 TSO E REXX User s Guide ...
Page 58: ...Tracing Expressions with the TRACE Instruction 40 z OS V1R1 0 TSO E REXX User s Guide ...
Page 78: ...60 z OS V1R1 0 TSO E REXX User s Guide ...
Page 86: ...Built In Functions 68 z OS V1R1 0 TSO E REXX User s Guide ...
Page 128: ...Issuing Other Types of Commands from an Exec 110 z OS V1R1 0 TSO E REXX User s Guide ...
Page 136: ...Debugging Execs 118 z OS V1R1 0 TSO E REXX User s Guide ...
Page 170: ...Protecting Elements in the Data Stack 152 z OS V1R1 0 TSO E REXX User s Guide ...
Page 201: ...Part 3 Appendixes Copyright IBM Corp 1988 2001 183 ...
Page 202: ...184 z OS V1R1 0 TSO E REXX User s Guide ...
Page 222: ...Using Variables 204 z OS V1R1 0 TSO E REXX User s Guide ...
Page 226: ...208 z OS V1R1 0 TSO E REXX User s Guide ...
Page 238: ...220 z OS V1R1 0 TSO E REXX User s Guide ...
Page 241: ......