UNSTRING Statement

The UNSTRING statement causes contiguous data in a sending field to be separated and placed into multiple receiving fields.

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

Read syntax diagramSkip visual syntax diagram
UNSTRING Statement - Format

>>-UNSTRING--identifier-1--------------------------------------->

>--+-------------------------------------------------------------+-->
   '-DELIMITED--+----+--+-----+--+-identifier-2-+--| OR Phrase |-'   
                '-BY-'  '-ALL-'  '-literal-1----'                    

>--INTO--------------------------------------------------------->

   .------------------------------------------------------.   
   V                                                      |   
>----identifier-4--| DELIMITER Phrase |--| COUNT Phrase |-+----->

>--+---------------------------------+-------------------------->
   '-+------+--POINTER--identifier-7-'   
     '-WITH-'                            

>--+--------------------------------+--------------------------->
   '-TALLYING--+----+--identifier-8-'   
               '-IN-'                   

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

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

>--+--------------+--------------------------------------------><
   '-END-UNSTRING-'   

OR Phrase

|--+-----------------------------------+------------------------|
   | .-------------------------------. |   
   | V                               | |   
   '---OR--+-----+--+-identifier-3-+-+-'   
           '-ALL-'  '-literal-2----'       

DELIMITER Phrase

|--+---------------------------------+--------------------------|
   '-DELIMITER--+----+--identifier-5-'   
                '-IN-'                   

COUNT Phrase

|--+-----------------------------+------------------------------|
   '-COUNT--+----+--identifier-6-'   
            '-IN-'                   

Related Information:
identifier-1
Represents the sending field.

It must be an alphanumeric data item; it cannot be reference modified. Data is transferred from this field to the receiving fields.

IBM Extension

Start of change Identifier-1 can be a DBCS or national data-item. End of change

End of IBM Extension