A period in a template acts as a place holder. The data that corresponds to the
period is not assigned to a variable name. You can use a period as a "dummy
variable" within a group of variables or at the end of a template to collect unwanted
information.
PARSE VALUE 'Value with Periods in it.' WITH pattern . type .
/* pattern contains 'Value'
*/
/* type contains 'Periods'
*/
/* the periods replace the words "with" and "in it." */
String
You can use a string in a template to separate data as long as the data includes the
string as well. The string becomes the point of separation and is not included as
data.
phrase = 'To be, or not to be?'
/* phrase containing comma
*/
PARSE VAR phrase part1 ',' part2
/* template containing comma */
/*
as string separator
*/
/* part1 contains 'To be'
*/
/* part2 contains ' or not to be?' */
In this example, notice that the comma is not included with ’To be’ because the
comma is the string separator.
Variable
When you do not know in advance what string to specify as separator in a
template, you can use a variable enclosed in parentheses. The variable value must
be included in the data.
separator = ','
phrase = 'To be, or not to be?'
PARSE VAR phrase part1 (separator) part2
/* part1 contains 'To be'
*/
/* part2 contains ' or not to be?' */
Again, in this example, notice that the comma is not included with ’To be’ because
the comma is the string separator.
Number
You can use numbers in a template to indicate the column at which to separate
data. An unsigned integer indicates an absolute column position and a signed
integer indicates a relative column position.
v
Absolute column position
An unsigned integer or an integer prefixed with an equal sign (=) in a template
separates the data according to absolute column position. The first segment
starts at column 1 and goes up to, but does not include, the information in the
column number specified. The subsequent segments start at the column
numbers specified.
quote = 'Ignorance is bliss.'
....+....1....+....2
PARSE VAR quote part1 5 part2
/* part1 contains 'Igno'
*/
/* part2 contains 'rance is bliss.' */
This example could have also been coded as follows. Note the explicit use of the
column 1 indicator prior to
part1
that was implied in the previous example and
the use of the
=5 part2
to indicate the absolute position, column 5.
quote = 'Ignorance is bliss.'
....+....1....+....2
Parsing Data
90
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: ......