Purpose

>>-PULL--+---------------+--;----------------------------------><
'-template_list-'
PULL reads a string from the program stack.
If the program stack is empty, PULL then tries reading a line from
the current terminal input device. It is just a short form of the
instruction:

>>-PARSE UPPER PULL--+---------------+--;----------------------><
'-template_list-'
The current head-of-queue is read as one string.
Without a
template_list specified, no further action is taken (and the string is thus
effectively discarded). If specified, a
template_list is usually a single template, which is a list of symbols
separated by blanks or patterns or both. (The
template_list can be several templates separated by commas, but PULL parses
only one source string; if you specify several comma-separated templates,
variables in templates other than the first one are assigned the null
string.) The string is translated to uppercase (that is, lowercase
a–
z to uppercase
A–
Z) and then parsed into variables according to the rules
described in the section on parsing (
General Description). Use the PARSE PULL instruction if you do not desire uppercase
translation.
Note: - The REXX/CICS implementation of the external data queue is the
program stack. The language processor reads a line from the program
stack. If the program stack is empty, a terminal read occurs. The
program stack for you is in an RLS queue named \SYSTEM\rexxtnum\*PROGSTACK* where rexxtrnum is an internal REXX task number.
- If the PULL causes a read from the terminal, the variable PULLKEY
is set upon completion of the PULL command. It will contain the name
of the aid key pressed in response to the PULL command (for example:
ENTER, PFKEY 1, PAKEY 1, MSR, PEN, or CLEAR).
For information on named queues, see the REXX
List System LPULL command in section LPULL.
- Example:
-
Say 'Do you want to erase the file? Answer Yes or No:'
Pull answer .
if answer='NO' then say 'The file will not be erased.'
Here the dummy placeholder, a period (.), is used on the template to isolate the first word the
user enters.
If the external data queue is empty, a console
read is issued and the program pauses, if necessary, until a line
is complete.
The QUEUED built-in function (see QUEUED) returns the number of lines currently
in the program stack.