SORT
Authorization
General User
Purpose
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.
Operands
- fn1 ft1 fm1
- is the name of the file containing the records to be sorted.
- fn2 ft2 fm2
- is the name of the new output file to contain the sorted records.
Usage Notes
- The input and output files must not have the same file identifiers, because SORT cannot write
the sorted output back into the space occupied by the input file. If
fileid2 is the same as fileid1, message
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.DMSSRT019E Identical fileids
- Entering Sort Control Fields: After the SORT command is entered, CMS responds with the following
message on the terminal:
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.DMSSRT604R Enter sort fields:
- Virtual Storage Requirements for Sorting: The sorting operation takes place with two passes of the input file. The first pass creates an ordered pointer table in virtual storage. The second pass uses the pointer table to read the input file in a random manner and write the output file. Therefore, the size of storage and the size and number of sort fields are the limiting factors in determining the number of records that can be sorted at any one time.
Responses
DMSSRT604R Enter sort fields:
You are requested to enter SORT control fields. You should enter them in the form described
previously in Entering Sort Control Fields.
Messages and Return Codes
- DMS002E File [fn [ft [fm]]] not found [RC=28]
- DMS009E Column col exceeds record length [RC=24]
- DMS019E Identical fileids [RC=24]
- DMS034E File fn ft fm is not fixed length [RC=32]
- DMS037E Filemode mode[(vdev)] is accessed as read/only [RC=36]
- DMS053E Invalid sort field pair defined [RC=24]
- DMS054E Incomplete fileid specified [RC=24]
- DMS062E Invalid * in fileid [fn ft [fm]] [RC=20]
- DMS063E No list entered [RC=40]
- DMS069E Filemode mode not accessed [RC=36]
- DMS070E Invalid parameter parameter [RC=24]
- DMS104S Error nn reading file fn ft fm from disk or directory [RC=100]
- DMS105S Error nn writing file fn ft fm on disk or directory [RC=100]
- DMS212E Maximum number of records exceeded [RC=40]
- DMS2521E SORT cannot be performed on empty file fileid1 [RC=88]
Additional system messages may be issued by this command. The reasons for these messages and their location are:
Reason | Location |
---|---|
Errors in command syntax | Command Syntax Error Messages |
Errors in the Shared File System | File Pool Server Messages |
Errors in using a file | File Error Messages |