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

Procedure Division Verbs
HP COBOL Manual for TNS/E Programs520347-003
9-261
UNSTRING
imperative-stmt-1
is an imperative statement to be executed when overflow occurs; that is, when
these conditions exist:
The initial value of pointer is less than 1 or greater than the length of
source.
All data-receiving areas have been acted upon, and source still contains
unexamined characters.
If you do not specify an OVERFLOW clause and an overflow occurs, control
passes to the next statement after UNSTRING.
imperative-stmt-2
is an imperative statement to be executed when overflow does not occur.
END-UNSTRING
ends the scope of the UNSTRING statement, causing the UNSTRING to be a
delimited-scope statement. If you omit the END-UNSTRING phrase, the presence
of the OVERFLOW or the NOT OVERFLOW phrase makes the UNSTRING
statement a conditional statement, which ends at the next period separator.
Usage Considerations:
Purpose
In general terms, the UNSTRING statement partitions the value of the sending
area (referenced by source ) into a sequence of strings of consecutive characters
and stores them in the receiving areas (referenced by a list of one or more
instances of result).
Execution of the UNSTRING Statement
The execution of the UNSTRING statement consists of these three phases:
1. Initialization phase
In the initialization phase, the UNSTRING statement performs these
initialization operations before beginning to cycle through the list of INTO
phrases:
It establishes the source item as the sending area. Even if the item has a
variable size (is defined with the OCCURS DEPENDING clause), the initial
size is used as the sending area size for the duration of statement
execution.
If the UNSTRING statement includes the POINTER phrase, the
initialization establishes the pointer item as the pointer variable. The
initial value of this item determines the relative character position within the
sending area at which the unstring operation begins. The first character
position is 1.