Rational Developer for System z
COBOL for Windows, Version 7.5, Programming Guide


Describing the sort or merge file

Describe the sort file to be used for sorting or merging. You need SELECT clauses and SD entries even if you are sorting or merging data items only from WORKING-STORAGE or LOCAL-STORAGE.

Code as follows:

  1. Write one or more SELECT clauses in the FILE-CONTROL paragraph of the ENVIRONMENT DIVISION to name a sort file. For example:

    ENVIRONMENT DIVISION.
    INPUT-OUTPUT SECTION.
    FILE-CONTROL.
        SELECT Sort-Work-1 ASSIGN TO SortFile.

    Sort-Work-1 is the name of the file in your program. Use this name to refer to the file.

  2. Describe the sort file in an SD entry in the FILE SECTION of the DATA DIVISION. Every SD entry must contain a record description. For example:

    DATA DIVISION.
    FILE SECTION.
    SD  Sort-Work-1
        RECORD CONTAINS 100 CHARACTERS.
    01  SORT-WORK-1-AREA.
        05  SORT-KEY-1   PIC  X(10).
        05  SORT-KEY-2   PIC  X(10).
        05  FILLER       PIC  X(80).

The file described in an SD entry is the working file used for a sort or merge operation. You cannot perform any input or output operations on this file.

related references
FILE SECTION entries


Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)