STRING Statement

The STRING statement strings together the partial or complete contents of two or more data items or literals into one single data item.

One STRING statement can be written instead of a series of MOVE statements.

Read syntax diagramSkip visual syntax diagram
STRING Statement - Format

>>-STRING------------------------------------------------------->

   .-----------------------------------------------------------.   
   | .------------------.                                      |   
   V V                  |                                      |   
>------+-identifier-1-+-+--DELIMITED--+----+--+-identifier-2-+-+-->
       '-literal-1----'               '-BY-'  +-literal-2----+     
                                              '-SIZE---------'     

>--INTO--identifier-3--+---------------------------------+------>
                       '-+------+--POINTER--identifier-4-'   
                         '-WITH-'                            

>--+------------------------------------------+----------------->
   '-+----+--OVERFLOW--imperative-statement-1-'   
     '-ON-'                                       

>--+-----------------------------------------------+------------>
   '-NOT--+----+--OVERFLOW--imperative-statement-2-'   
          '-ON-'                                       

>--+------------+----------------------------------------------><
   '-END-STRING-'   

Note: All identifiers (except identifier-4, the POINTER item) must have USAGE DISPLAY, explicitly or implicitly.
identifier-1
Represents the sending field(s). When the sending field or any of the delimiters is an elementary numeric item, it must be described as an integer, and its PICTURE character-string must not contain the symbol P.
literal-1
Represents the sending field(s). All literals must be nonnumeric literals; each may be any figurative constant without the ALL literal. When a figurative constant is specified, it is considered a 1-character nonnumeric literal.
IBM Extension
identifier-1 through identifier-3
Can not be external floating-point items.
End of IBM Extension
IBM Extension

If one of identifier-1, identifier-2, or identifier-3 is a DBCS data item, then all of them must be DBCS data items and all literals must be DBCS literals.

Start of change If one of identifier-1, identifier-2, or identifier-3 is a national data item, then all of them must be national data items. End of change

If one of literal-1 or literal-2 is a DBCS literal, then they must both be DBCS literals and identifier-1 through identifier-3 must be DBCS data items.

SPACE is the only figurative constant allowed for DBCS items.

End of IBM Extension
Related Information: