Describing the output from sorting or merging

If the output from sorting or merging is a file, describe the file by following the procedure below.

  1. Write a SELECT clause in the FILE-CONTROL paragraph of the ENVIRONMENT DIVISION to name the output file. For example:
    
    ENVIRONMENT DIVISION.
    INPUT-OUTPUT SECTION.
    FILE-CONTROL.
        SELECT Output-File ASSIGN TO OutFile.
    

    Output-File is the name of the file in your program. Use this name to refer to the file.

  2. Describe the output file (or files when merging) in an FD entry in the FILE SECTION of the DATA DIVISION. For example:
    
    DATA DIVISION.
    FILE SECTION.
    FD  Output-File 
        LABEL RECORDS ARE STANDARD
        BLOCK CONTAINS 0 CHARACTERS 
        RECORDING MODE IS F 
        RECORD CONTAINS 100 CHARACTERS.
    01  Output-Record   PIC X(100).