Faster Compiling
By converting to non-procedural COBOL code, you improve the EXCP and the job elapsed time. The programmatic implementation of the non-procedural COBOL code can be seen in the following code snippet:
ID DIVISION.
PROGRAM-ID. PGMSORT.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT SORTIN ASSIGN TO SORTIN.
SELECT SORTOUT ASSIGN TO SORTOUT.
SELECT SORT-FILE ASSIGN TO SORTFILE.
DATA DIVISION.
FILE SECTION.
FD SORTIN RECORD CONTAINS 160 CHARACTERS
LABEL RECORD STANDARD BLOCK 16000
DATA RECORDS ARE SORTIN-RECORD.
01 SORTIN-RECORD.
05 FILLER PIC X(160).
FD SORTOUT RECORD CONTAINS 160 CHARACTERS
LABEL RECORD STANDARD BLOCK 16000
DATA RECORDS ARE SORTOUT-RECORD.
01 SORTOUT-RECORD.
05 FILLER PIC X(160).
SD SORT-FILE RECORD CONTAINS 160 CHARACTERS
DATA RECORD SORT-RECORD.
01 SORT-RECORD.
05 SORT-KEY PIC X(8).
05 FILLER PIC X(152).
WORKING-STORAGE SECTION.
PROCEDURE DIVISION.
MASTER SECTION.
SORT SORT-FILE
ON DESCENDING KEY SORT-KEY
USING SORTIN
GIVING SORTOUT.
IF SORT-RETURN > 0
DISPLAY "SORT FAILED WITH RC:" SORT-RETURN.
STOP RUN.