COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs522555-006
9-259
STRING
END-STRING
ends the scope of the STRING statement, causing the STRING to be a delimited-
scope statement. If the STRING statement does not end with an END-STRING
phrase, the presence of the OVERFLOW or the NOT OVERFLOW phrase causes
the STRING statement to be a conditional statement, which ends at the next period
separator.
Usage Considerations:
Operand Identification
For each identifier, the process of operand identification occurs only once, at the
beginning of the execution of the STRING statement.
Initialization
The execution of the STRING statement begins in this manner:
1. The data item specified by result is established as the receiving item.
2. When the POINTER phrase appears, the data item specified by pointer is
established as the pointer variable.
If the initial value of pointer is less than 1 or greater than the size of the
receiving item, then the overflow condition exists immediately and no string
operation occurs; otherwise, the initial value of pointer determines the
relative character position within result at which the first sending value is
assigned. The leftmost character position is designated to be 1.
When the POINTER phrase does not appear, the string operation presumes an
initial relative character position of 1.
String Operation Cycle
The string operation transfers data from each part-1, in the same order as they
are specified in the STRING statement. The steps involved in the transfer of a
sending value are:
°
Determining the transfer string
If the applicable DELIMITED phrase specifies delimiter, then the value of
the current part-1 is examined character by character from left to right until
either of these is found: the end of the value, or a sequence of contiguous
characters that matches the value of delimiter.
If a match is found, the transfer string consists of the portion of the sending
value preceding the character that matches the first character of the delimiter;
otherwise, the transfer string consists of the entire sending value.
If the applicable DELIMITED phrase specifies SIZE, then no delimiter exists
and the transfer string always consists of the entire sending value.