SORT

CMS Commands

sort.helpcmd.txt
SORT                                                      CMS Transient command

Use the SORT command to read fixed-length records from a CMS input file,
arrange them in ascending EBCDIC order according to specified sort fields, and
create a new file containing the sorted records.  The format of the SORT
command is:
+----------+------------------------------------------------------------------+
| SORT     | fileid1 fileid2                                                  |
+----------+------------------------------------------------------------------+
where:

fileid1  is the file identifier (filename, filetype, filemode) of the file
         containing the records to be sorted.

fileid2  is the file identifier (filename, filetype, filemode) of the new
         output file to contain the sorted records.


Usage note:

The input and output files must not have the same file identifiers, since SORT
cannot write the sorted output back into the space occupied by the input file.
If fileid2 is the same as fileid1, message DMSSRT019E IDENTICAL FILEIDS is
issued and the SORT operation does not take place.  If fileid1 and fileid2 are
different and a file with the same name as fileid2 already exists, the existing
file is replaced when the SORT operation takes place.

Entering Sort Control Fields:  After the SORT command is entered, CMS responds
with the following message on the terminal:
   DMSSRT604R    ENTER SORT FIELDS:
Respond by entering one or more pairs of numbers of the form "xx yy"; separate
each pair by one or more blanks.  Each "xx" is the starting character position
of a sort field within each input record and "yy" is the ending character
position.  The leftmost pair of numbers denotes the major sort field.  The
number of sort fields is limited to the number of fields you can enter on one
line.  The records can be sorted on up to a total of 253 positions.