NET/MASTER Network Control Language (NCL) Reference Manual

Using PARSE and SEGMENT
Verb Syntax and Variable Access Methods
106126 Tandem Computers Incorporated 11–27
Using SEGMENT to parse a string of data is an alternative to providing explicit length
variable specifications as part of a VARS list. The following examples do the same
thing as they delimit the message This is a message:
INTREAD ARGS SEGMENT=1
The results are:
&1 = T
&2 = i
&3 = a
&4 = m
INTREAD VARS=(&1(1),&2(1),&3(1),&4(1))
The results are:
&1 = T
&2 = i
&3 = a
&4 = m
The SEGMENT keyword is also used by the PARSE verb for the same reason: to
specify how much of each delimited section of the message to put into a variable. The
PARSE verb is discussed in the following subsection, “Using the PARSE Verb.”
Using the PARSE Verb The PARSE verb provides additional techniques to split a message into sections. You
can use the PARSE verb with the PARSE keyword, to specify how to delimit a
message. You can use the PARSE verb with the SEGMENT keyword, to specify how
much to put into a variable after a message is delimited. Here are some examples of
the PARSE verb:
PARSE ARGS PARSE=YES DATA="344,721"
The result is:
&1 = 344,721
PARSE ARGS PARSE=NO SEGMENT=1 DATA="343,721"
The results are:
&1 = 3
&2 = 4
&3 = 3
&4 = ,
&5 = 7
&6 = 2
&7 = 1