Sort File Description Entry

A sort file description entry describes the physical structure for a sort file.

General Format

SD file-name
   [ RECORD { CONTAINS [min TO] max CHARACTERS } ]
            { IS VARYING IN SIZE [ FROM min ]  }
            {        [ TO max ] CHARACTERS     }
            {        [ DEPENDING ON depend ]   }

   [ DATA { RECORD IS   } {record-name} ... ] 
          { RECORDS ARE }

   [ VALUE OF FILE-ID IS id-name ]

Syntax Rules

  1. file-name must refer to a file name contained in a SELECT clause in the Environment Division. That SELECT clause may contain only ASSIGN and FILE STATUS clauses. However, a PASSWORD clause, TRACK-AREA clause, PROCESSING MODE clause, RECORDING MODE clause, FILE-LIMIT clause, VALUE OF clause, and APPLY clause may appear when the compiler is in the IBM DOS/VS COBOL compatibility mode. These phrases are scanned, but otherwise they are ignored.
  2. The clauses following file-name may appear in any order.
  3. id-name must be either a non-numeric literal or the name of an alphanumeric data item in Working Storage. The value of this name is used as the file's external name.
  4. If a file-spec is specified in the file's ASSIGN clause, id-name must be identical to file-spec.
  5. One or more record description entries must follow a sort file description entry.

General Rules

  1. No I/O statement may refer to a file described by a sort file description entry. Only the SORT and MERGE statements may refer to file-name.
  2. The sort file description entry clauses are described in the following sections.
Note: The compiler has an internal restriction of at least 6 bytes for SORT FILE records. If a record is shorter than that, the compiler detects it and pads the record to 6 bytes.