
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?'
/* user enters "Knowledge */
/* is power."
*/
PULL word1 word2 word3
/* word1 contains 'KNOWLEDGE' */
/* word2 contains 'IS'
*/
/* word3 contains 'POWER.'
*/
The PARSE PULL instruction assigns information, without altering it, to variable
names.
SAY 'What is the quote for the day?'
/* user enters "Knowledge */
/* is power."
*/
PARSE PULL word1 word2 word3
/* word1 contains 'Knowledge' */
/* word2 contains 'is'
*/
/* word3 contains 'power.'
*/
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
/* word1 contains 'KNOWLEDGE' */
/* word2 contains 'IS'
*/
/* word3 contains 'POWER.'
*/
The PARSE ARG instruction assigns information, without altering it, to variable
names.
PARSE ARG word1 word2 word3
/* word1 contains 'Knowledge' */
/* word2 contains 'is'
*/
/* word3 contains 'power.'
*/
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.
Parsing Data
88
z/OS V1R1.0 TSO/E REXX User’s Guide
Summary of Contents for TSO/E REXX
Page 1: ...z OS TSO E REXX User s Guide SA22 7791 00 ...
Page 2: ......
Page 3: ...z OS TSO E REXX User s Guide SA22 7791 00 ...
Page 10: ...viii z OS V1R1 0 TSO E REXX User s Guide ...
Page 12: ...x z OS V1R1 0 TSO E REXX User s Guide ...
Page 14: ...xii z OS V1R1 0 TSO E REXX User s Guide ...
Page 18: ...xvi z OS V1R1 0 TSO E REXX User s Guide ...
Page 20: ...2 z OS V1R1 0 TSO E REXX User s Guide ...
Page 58: ...Tracing Expressions with the TRACE Instruction 40 z OS V1R1 0 TSO E REXX User s Guide ...
Page 78: ...60 z OS V1R1 0 TSO E REXX User s Guide ...
Page 86: ...Built In Functions 68 z OS V1R1 0 TSO E REXX User s Guide ...
Page 128: ...Issuing Other Types of Commands from an Exec 110 z OS V1R1 0 TSO E REXX User s Guide ...
Page 136: ...Debugging Execs 118 z OS V1R1 0 TSO E REXX User s Guide ...
Page 170: ...Protecting Elements in the Data Stack 152 z OS V1R1 0 TSO E REXX User s Guide ...
Page 201: ...Part 3 Appendixes Copyright IBM Corp 1988 2001 183 ...
Page 202: ...184 z OS V1R1 0 TSO E REXX User s Guide ...
Page 222: ...Using Variables 204 z OS V1R1 0 TSO E REXX User s Guide ...
Page 226: ...208 z OS V1R1 0 TSO E REXX User s Guide ...
Page 238: ...220 z OS V1R1 0 TSO E REXX User s Guide ...
Page 241: ......