Joining data items (STRING)
Use
the STRING statement to join all or parts of several data items
or
literals into one data item. One STRING statement can take the
place of several MOVE statements.
The STRING statement transfers data into a receiving data item in
the order that you indicate. In the STRING statement you also specify:
- A delimiter for each set of sending fields that, if encountered,
causes those sending fields to stop being transferred (DELIMITED BY
phrase)
- (Optional) Action to be taken if the receiving field is filled before all
of the sending data has been processed (ON OVERFLOW phrase)
- (Optional) An integer data item that indicates the leftmost
character position within the receiving field into which data should be
transferred (WITH POINTER phrase)
The receiving data item must not be an edited item, or a display or
national floating-point item. If the receiving data item has:
- USAGE DISPLAY, each identifier in the statement except the POINTER
identifier must have USAGE DISPLAY, and each literal in the
statement must be alphanumeric
- USAGE NATIONAL, each identifier in the statement except the
POINTER identifier must have USAGE NATIONAL, and each
literal in the statement must be national
- USAGE DISPLAY-1, each identifier in the statement except
the POINTER identifier must have USAGE DISPLAY-1, and each
literal in the statement must be DBCS
Only that portion of the receiving field into which data is written by
the STRING statement is changed.
Example: STRING statement
related tasks
Handling errors in joining and splitting strings
related references
STRING statement
(COBOL for Windows Language Reference)
|