COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs522555-006
9-279
UNSTRING
If you execute
UNSTRING U DELIMITED BY SPACE OR "."
INTO WORD-1 DELIMITER IN DEL-1
...
WORD-5 DELIMITER IN DEL-5
you get
"The "
in WORD-1,
" "
in DEL-1, and so on down to
"handy "
in WORD-5 and
"."
in DEL-5.
If you include the DELIMITER phrase in the INTO phrase for this cycle, the
unstring operation advances the current character position in the sending area
to the first character following the delimiter string located in this cycle.
If the specification of the matched delimiter includes the keyword ALL and the
portion of the sending area following the delimiter string contains one or more
repetitions of that set of characters, then the unstring operation advances the
current character position past all repetitions; therefore the unstring operation
considers two or more contiguous occurrences of the matched delimiter string
as equivalent to a single occurrence in determining the beginning character for
the next examination cycle.
If you include a COUNT phrase in the INTO phrase for this cycle, the unstring
operation assigns the numeric value equal to the number of characters
examined (excluding the delimiter string, if any) to count in accordance with
the rules for an elementary move operation.
If you execute
UNSTRING U DELIMITED BY SPACE OR "."
INTO WORD-1 COUNT IN COUNT-1
...
WORD-5 COUNT IN COUNT-5
you get
"The "
in WORD-1, but 3 in COUNT-1, and you get
"stateme"