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
- 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.
- The clauses following
file-name may appear in any order.
- 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.
- If a
file-spec is specified in the file's ASSIGN clause,
id-name must be identical to
file-spec.
- One or more record description entries must follow a sort file description entry.
General Rules
- 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.
- The sort file description entry clauses are further described in this section.
Note: For objects compiled for runtimes earlier than version 10, 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. Note also that
in versions prior to 5.0, using SORT FILE with records shorter than 6 bytes would cause crashes.