COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs522555-006
9-280
UNSTRING
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.
When the execution of an UNSTRING statement with a TALLYING phrase
terminates, either normally or due to an overflow condition, tally contains a
value equal to its initial value plus the number of data receiving items that were
assigned new values.
If an overflow condition arises, execution of the UNSTRING statement
terminates at that point.
3. OVERFLOW/NO OVERFLOW processing phase (optional)
If you include an OVERFLOW phrase, the imperative statement in that phrase
is executed; otherwise control is transferred to the next executable statement
in the normal way.
Operand Identification
For each identifier, the process of operand identification occurs only once, at the
beginning of the execution of the UNSTRING statement.
Operand Overlap
Neither the storage area referenced by pointer nor that referenced by tally
can be the same as or overlap the storage area referenced by any other identifier
appearing in the UNSTRING statement.
The storage area referenced by result, delimstore, and count must not
overlap or be the same as any of the storage areas referenced by source,
delim-1, or delim-2.
Violation of these rules produces unpredictable results.