VMS Help
COBOL, PROCEDURE_DIVISION, SORT, 1format_file
*Conan The Librarian
|
The SORT statement creates a sort file by executing input procedures or
transferring records from an input file. It sorts the records in the
sort file using one or more keys that you specify. Finally, it returns
each record from the sort file, in sorted order, to output procedures
or an output file.
Format -
SORT sortfile { ON { ASCENDING } KEY { sortkey } ... } ...
{ { DESCENDING } }
[ WITH DUPLICATES IN ORDER ]
[ COLLATING SEQUENCE IS alpha ]
{ INPUT PROCEDURE IS first-proc [ { THRU } end-proc ] }
{ [ { THROUGH } ] }
{ USING { infile } ... }
{ OUTPUT PROCEDURE IS first-proc [ { THRU } end-proc ] }
{ [ { THROUGH } ] }
{ GIVING { outfile } ... }
is a file-name described in a sort-merge file description (SD) entry in
the Data Division.
is the data-name of a data item in a record associated with sortfile.
is an alphabet-name defined in the SPECIAL-NAMES paragraph of the
Environment Division.
is the section-name or paragraph-name of the first (or only) section or
paragraph of the INPUT or OUTPUT procedure range.
is the file-name of the input file. It must be described in a file
description (FD) entry in the Data Division.
is the section-name or paragraph-name of the last section or paragraph
of the INPUT or OUTPUT procedure range.
is the file-name of the output file. It must be described in a file
description (FD) entry in the Data Division.