The following COBOL program depicts the use of
STRING DELIMITED BY SIZE
IDENTIFICATION DIVISION.
PROGRAM-ID. PGM040.
AUTHOR. MAINFRAMEWIZARD.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-TITLE PIC X(3) VALUE SPACES.
01 WS-FIRST-NAME PIC X(20) VALUE SPACES.
01 WS-LAST-NAME PIC X(20) VALUE SPACES.
01 WS-FULL-NAME PIC X(43) VALUE SPACES.
PROCEDURE DIVISION.
10000-MAIN-PARA.
MOVE 'MR#' TO WS-TITLE
MOVE 'MAINFRAME#WIZARD#' TO WS-FIRST-NAME
MOVE 'COM#' TO WS-LAST-NAME
STRING WS-TITLE DELIMITED BY SIZE
WS-FIRST-NAME DELIMITED BY SIZE
WS-LAST-NAME DELIMITED BY SIZE
INTO WS-FULL-NAME
DISPLAY 'RESULTANT STRING IS = '
WS-FULL-NAME
STOP RUN.
The output of the program is
RESULTANT STRING IS = MR#MAINFRAME#WIZARD# COM#