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

pointer ’s value is its initial value plus the total number of characters moved. pointer
cannot reference a special register.
imperative-stmt-1
is an imperative statement to be executed when the internal index points past the end of
result. OVERFLOW also occurs if the initial value of pointer is less than 1 or greater than
the length of result. If no OVERFLOW statement is given, control passes to the next statement
after STRING.
imperative-stmt-2
is an imperative statement to be executed when the internal index does not point past the end
of result.
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.
Copying the transfer string to the receiving item
Assignment of the transfer string to the receiving item (result ) proceeds on a character
by character basis. Beginning with the leftmost character, each character of the transfer
464 Procedure Division Verbs