IDENTIFICATION DIVISION.
PROGRAM-ID. STRING-UNSTRING.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 FIRST-NAME PIC X(10).
77 MIDDLE-NAME PIC X(10).
77 LAST-NAME PIC X(10).
77 NAME PIC X(30).
77 M PIC X VALUE SPACES.
PROCEDURE DIVISION.
MAIN-PARA.
DISPLAY "ENTER YOUR FIRST NAME :".
ACCEPT FIRST-NAME.
DISPLAY FIRST-NAME.
DISPLAY "ENTER YOUR MIDDLE NAME :".
ACCEPT MIDDLE-NAME.
DISPLAY MIDDLE-NAME.
DISPLAY "ENTER YOUR LAST NAME :".
ACCEPT LAST-NAME.
DISPLAY LAST-NAME.
STRING FIRST-NAME DELIMITED BY SPACES,
M DELIMITED BY SIZE,
MIDDLE-NAME DELIMITED BY SPACES,
M DELIMITED BY SIZE,
LAST-NAME DELIMITED BY SPACES,
INTO NAME.
DISPLAY " THE GIVEN STRINGS AFTER STRING OPERATION IS : ".
DISPLAY NAME.
UNSTRING NAME DELIMITED BY M,
INTO FIRST-NAME,
MIDDLE-NAME,
LAST-NAME.
DISPLAY "THE VARIOUS STRINGS AFTER UNSTRING OPERATION ARE :".
DISPLAY FIRST-NAME
DISPLAY MIDDLE-NAME.
DISPLAY LAST-NAME.
STOP RUN.
PROGRAM-ID. STRING-UNSTRING.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 FIRST-NAME PIC X(10).
77 MIDDLE-NAME PIC X(10).
77 LAST-NAME PIC X(10).
77 NAME PIC X(30).
77 M PIC X VALUE SPACES.
PROCEDURE DIVISION.
MAIN-PARA.
DISPLAY "ENTER YOUR FIRST NAME :".
ACCEPT FIRST-NAME.
DISPLAY FIRST-NAME.
DISPLAY "ENTER YOUR MIDDLE NAME :".
ACCEPT MIDDLE-NAME.
DISPLAY MIDDLE-NAME.
DISPLAY "ENTER YOUR LAST NAME :".
ACCEPT LAST-NAME.
DISPLAY LAST-NAME.
STRING FIRST-NAME DELIMITED BY SPACES,
M DELIMITED BY SIZE,
MIDDLE-NAME DELIMITED BY SPACES,
M DELIMITED BY SIZE,
LAST-NAME DELIMITED BY SPACES,
INTO NAME.
DISPLAY " THE GIVEN STRINGS AFTER STRING OPERATION IS : ".
DISPLAY NAME.
UNSTRING NAME DELIMITED BY M,
INTO FIRST-NAME,
MIDDLE-NAME,
LAST-NAME.
DISPLAY "THE VARIOUS STRINGS AFTER UNSTRING OPERATION ARE :".
DISPLAY FIRST-NAME
DISPLAY MIDDLE-NAME.
DISPLAY LAST-NAME.
STOP RUN.