Dropping A Buffer With The Dropbuf Command; Finding The Number Of Buffers With The Qbuf Command - IBM TSO/E REXX User Manual

Table of Contents

Advertisement

Creating a Buffer on the Data Stack
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 */
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

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
144
z/OS V1R1.0 TSO/E REXX User's Guide
PULL ....
...
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.
. .
.
. .
.
/* RC = 2 */

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents