>>-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 (page ***). Use the PARSE PULL instruction if you do not desire uppercase translation.
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 page ***) returns the number of lines currently in the program stack.