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

Example 139 UNSTRING Statement
Input:
DATA DIVISION.
WORKING-STORAGE SECTION.
77 SOURCE-STRING PIC X(18) VALUE "12345 MICKEY ABCDE".
77 UNPART-1 PIC X(3).
77 UNPART-2 PIC X(3).
77 UNPART-3 PIC X(3).
PROCEDURE DIVISION.
A10-START.
UNSTRING SOURCE-STRING DELIMITED BY " "
INTO UNPART-1 UNPART-2 UNPART-3
DISPLAY "UNPART-1 = " UNPART-1
DISPLAY "UNPART-2 = " UNPART-2
DISPLAY "UNPART-3 = " UNPART-3
STOP RUN.
Output:
>RUN RUNUNIT
UNPART-1 = 123
UNPART-2 = MIC
UNPART-3 = ABC
In Example 140, UNSTRING separates a name, entered as it would be typed on a mailing envelope,
into a last name and a remainder. You could use this mechanism to build records that can be
sorted on last and first name.
482 Procedure Division Verbs