COBOL Manual for TNS and TNS/R Programs
Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs—522555-006
9-260
STRING
°
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 string is moved into the receiving item character position designated
by the pointer value, which is incremented by 1 after each character is moved.
°
Overflowing the size of the receiving item
Overflow occurs if not all of the characters of a transfer string can be moved to
the receiving item. The overflow condition exists when the pointer value
exceeds the size of the receiving item during assignment of any transfer string
or after completing assignment of any transfer string except the last one. After
assignment of the last transfer string, the pointer value can be one character
past the end of the receiving item, and overflow does not occur unless there
are leftover characters in the transfer string.
If the overflow condition exists, the string operation terminates immediately.
Any remaining characters in the current transfer string are ignored; any
sending values not yet processed are ignored.
•
State of the Rest of result
After termination of the string operation, only the portion of the data item specified
by result that was referenced as described earlier is changed. That is, any
portions preceding the first character assigned or following the last character
assigned retain their previous value.
When the execution of a STRING statement specifying a POINTER phrase
terminates, either normally or due to an overflow condition, the contents of the data
item specified by pointer contains a value equal to its initial value plus the total
number of characters transferred into the data item specified by result.
•
Overflow Condition
When an overflow condition exists, execution of the STRING statement terminates
at that point. If the OVERFLOW phrase is specified, the imperative statement in
that phrase is executed; otherwise control passes directly to the end of the
STRING statement.
•
Overlapping Operands
If any part of the storage area referenced by result or of that referenced by
pointer is the same as the storage area referenced by any other identifier
appearing in the STRING statement, the execution of the STRING statement will
produce unpredictable results.
•
National Data Items and National Literals
If any of the data items part-1, delimiter, and result is a national data item
or national literal, then all of them must be national items.