You can define and use variables to provide further flexibility of a PARSE VAR
instruction. Define the variable prior to the parse instruction, such as the
movex
variable in the following example. With the PARSE instruction, enclose the
variable in parenthesis, in place of a number. This variable
must be an unsigned
integer
. Therefore, use a sign outside the parenthesis to indicate how REXX is to
interpret the unsigned integer. REXX substitutes the numeric value for the
variable as follows:
quote = 'Ignorance is bliss.'
....+....1....+....2
movex = 3
/* variable position
*/
PARSE VAR quote part5 +10 part6 +3 part7 -(movex) part8
/* part5 contains 'Ignorance '
*/
/* part6 contains 'is '
*/
/* part7 contains 'bliss.'
*/
/* part8 contains 'is bliss.'
*/
Note:
The variable
movex
in the previous example must be an unsigned integer.
Always code a sign prior to the parenthesis to indicate how the integer is
to be interpreted. If you do not, the variable will be interpreted as a string
separator. Valid signs are:
– A plus sign (+) indicates column movement to the right
– A minus sign (-) indicates column movement to the left
– An equal sign (=) indicates an absolute column position.
For more information about parsing, see
.
Parsing Multiple Strings as Arguments
When passing arguments to a function or a subroutine, you can specify multiple
strings to be parsed. Arguments are parsed with the ARG, PARSE ARG, and
PARSE UPPER ARG instructions.
To pass multiple strings, separate each string with a comma. This comma is not a
string separator as illustrated in the example on page 90, although you can also
use a string separator within an argument template.
The following example passes three arguments separated by commas to an internal
subroutine. The first argument consists of two words "String One" that are parsed
into three variable names. The third variable name is set to null because there is no
third word. The second and third arguments are parsed entirely into variable names
string2
and
string3
.
CALL sub2 'String One', 'String Two', 'String Three'
..
.
EXIT
sub2:
PARSE ARG word1 word2 word3, string2, string3
/* word1 contains 'String'
*/
/* word2 contains 'One'
*/
/* word3 contains ''
*/
/* string2 contains 'String Two'
*/
/* string3 contains 'String Three' */
For more information about passing multiple arguments, see
Exercise - Practice with Parsing
What are the results of the following parsing examples?
Parsing Data
92
z/OS V1R1.0 TSO/E REXX User’s Guide
Содержание TSO/E REXX
Страница 1: ...z OS TSO E REXX User s Guide SA22 7791 00 ...
Страница 2: ......
Страница 3: ...z OS TSO E REXX User s Guide SA22 7791 00 ...
Страница 10: ...viii z OS V1R1 0 TSO E REXX User s Guide ...
Страница 12: ...x z OS V1R1 0 TSO E REXX User s Guide ...
Страница 14: ...xii z OS V1R1 0 TSO E REXX User s Guide ...
Страница 18: ...xvi z OS V1R1 0 TSO E REXX User s Guide ...
Страница 20: ...2 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 58: ...Tracing Expressions with the TRACE Instruction 40 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 78: ...60 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 86: ...Built In Functions 68 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 128: ...Issuing Other Types of Commands from an Exec 110 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 136: ...Debugging Execs 118 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 170: ...Protecting Elements in the Data Stack 152 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 201: ...Part 3 Appendixes Copyright IBM Corp 1988 2001 183 ...
Страница 202: ...184 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 222: ...Using Variables 204 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 226: ...208 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 238: ...220 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 241: ......