COBOL Manual for TNS/E Programs (H06.03+)

Procedure Division Verbs
HP COBOL Manual for TNS/E Programs520347-003
9-265
UNSTRING
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"
in WORD-3 but 9 in COUNT-3.
If you include the POINTER phrase, the unstring operation increments the
value of the pointer item by one for each character examined as a part of
this cycle. This includes each character in the value copied to the receiving
area, each character in the delimiter string (if any), and each character in any
contiguous repetitions of the delimiter string; therefore the resulting value of the
pointer variable reflects the relative character position within the sending area
at which the next cycle begins.
If the sending area still contains any unexamined characters and the current
receiving area is not the last one, then the unstring operation establishes the
next result item as the new current receiving area and begins another
unstring cycle.
If the sending area still contains any unexamined characters but the current
receiving area is the last one, then the overflow condition exists and the
unstring operation terminates.
If the sending area does not contain any unexamined characters, then the
unstring operation terminates normally and any remaining receiving areas are
ignored.