Instructions That Parse; Pull Instruction; Arg Instruction - IBM TSO/E REXX User Manual

Table of Contents

Advertisement

Parsing Data

Instructions that Parse

There are several REXX instructions and variations of instructions that parse data.

PULL Instruction

In earlier chapters PULL was described as an instruction that reads input from the
terminal and assigns it to one or more variables. If however, the data stack contains
information, the PULL instruction takes information from the data stack; and when
the data stack is empty, PULL takes information from the terminal. For information
about the data stack, see "Chapter 11. Storing Information in the Data Stack" on
page 135. PULL changes character information to uppercase and assigns it to one
or more variable names. When PULL is followed by more than one variable, it
parses the information into the available variables.
SAY 'What is the quote for the day?'
PULL word1 word2 word3
The PARSE PULL instruction assigns information, without altering it, to variable
names.
SAY 'What is the quote for the day?'
PARSE PULL word1 word2 word3
PARSE UPPER PULL causes the same result as PULL in that it changes character
information to uppercase before assigning it to one or more variables.

ARG Instruction

The ARG instruction takes information passed as arguments to an exec, function, or
subroutine, and puts it into one or more variable names. Before character
information is put into a variable name, ARG changes it to uppercase. When ARG is
followed by more than one variable name, it parses the information into the
available variable names. For example, if an exec named
USERID.REXX.EXEC(QUOTE) can receive arguments, you can invoke the exec
with the EXEC command and the three arguments as follows:
EXEC rexx.exec(quote) 'Knowledge is power.' exec
The exec receives the arguments with the ARG instruction as follows:
ARG word1 word2 word3
The PARSE ARG instruction assigns information, without altering it, to variable
names.
PARSE ARG word1 word2 word3
PARSE UPPER ARG causes the same result as ARG in that it changes character
information to uppercase before assigning it to one or more variables.
88
z/OS V1R1.0 TSO/E REXX User's Guide
/* user enters "Knowledge */
/* is power."
/* word1 contains 'KNOWLEDGE' */
/* word2 contains 'IS'
/* word3 contains 'POWER.'
/* user enters "Knowledge */
/* is power."
/* word1 contains 'Knowledge' */
/* word2 contains 'is'
/* word3 contains 'power.'
/* word1 contains 'KNOWLEDGE' */
/* word2 contains 'IS'
/* word3 contains 'POWER.'
/* word1 contains 'Knowledge' */
/* word2 contains 'is'
/* word3 contains 'power.'
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents