Finding The Number Of Elements In A Buffer; Exercises - Creating A Buffer On The Data Stack - IBM TSO/E REXX User Manual

Table of Contents

Advertisement

QBUF returns the total number of buffers created, not just the ones created by a
single exec. Thus if an exec issued two MAKEBUF commands and called a routine
that issued two more, when the routine issues a QBUF command, RC returns the
total number of buffers created, which is four.

Finding the Number of Elements In a Buffer

To find out how many elements are in the most recently created buffer, use the
TSO/E REXX QELEM command. QELEM returns in the REXX special variable RC,
the number of elements in the most recently created buffer.
PUSH A
'MAKEBUF'
PUSH B
PUSH C
'QELEM'
SAY 'The number of elements is' RC
QELEM does not return the number of elements on a data stack with no buffers
created by the MAKEBUF command. If QBUF returns 0, no matter how many
elements are on the stack, QELEM also returns 0.
For more information about these stack commands, see z/OS TSO/E REXX
Reference.

Exercises - Creating a Buffer on the Data Stack

1. What are the results of the following instructions?
a. What is item?
QUEUE A
QUEUE B
'MAKEBUF'
QUEUE C
PULL item
b. What is element?
PUSH 'a'
PUSH 'b'
'MAKEBUF'
PUSH 'c'
PUSH 'd'
'DROPBUF'
PARSE PULL element
c. What is stackitem?
QUEUE a
'MAKEBUF'
QUEUE b
'MAKEBUF'
QUEUE c
'DROPBUF'
PULL stackitem
d. What is RC?
PUSH A
'MAKEBUF'
PUSH B
CALL sub1
'QBUF'
SAY RC
EXIT
Creating a Buffer on the Data Stack
/* RC = 2 */
Chapter 11. Storing Information in the Data Stack
145

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents