
Specifies the name of a procedure used to select or modify input records before the sorting operation begins. If file-name-1 contains fixed-length records, the size of the records contained in the input files must not be greater than the largest record of file-name-1. ) must be neither less than the smallest record nor greater than the largest record of the file-name-1.

If file-name-1 contains variable-length records, the size of the records contained in the input files (file-name-2, file-name-3. The input files are automatically opened, read and closed.Īll input files must specify sequential or dynamic access mode and be defined in FD entries in the data division. When SORT statement is executed, these files should not be opened.

During the SORT operation, all the records from file-name-2, file-name-3. When both the COLLATING SEQUENCE phrase and the PROGRAM COLLATING SEQUENCE clause are omitted, the collating sequence indicated by the COLLSEQ compiler option is used. When the COLLATING SEQUENCE phrase is omitted, the PROGRAM COLLATING SEQUENCE clause in the OBJECT-COMPUTER paragraph used.

Must be specified in the ALPHABET clause of the SPECIAL-NAMES paragraph. The COLLATING SEQUENCE phrase has no effect for keys that are not alphabetic or alphanumeric. When the COLLATING SEQUENCE phrase is not specified, the key comparisons are performed according to the rules for comparison of operands. When the COLLATING SEQUENCE phrase is specified, the indicated collating sequence is used for key data items comparisons of alphabetic, alphanumeric, alphanumeric-edited, external floating-point and numeric-edited categories. Specifies the collating sequence to be used in alphanumeric comparisons for the KEY data items in this sort operation. If the DUPLICATES phrase is not specified, the order of these records is undefined. If the DUPLICATES phrase is specified and duplicates existed, the order of associated input files as specified in the SORT statement. DUPLICATES phrase used to specify the order when the duplicate records existed in the file. If all the keys associated with one record are equal to the corresponding keys in one or more other records, then considered that file has duplicate records.

KEY data items must not contain an OCCURS clause or be subordinate to an item that contains an OCCURS clause.If file-name-1 contains variable-length records, all of the KEY data-items must be contained within the minimum records size specified for file-name-1.If file-name-1 has more than one record description, the KEY data items need be specifies in only one of the record descriptions.A specific KEY data item must be physically located in the same position and have the same data format in each input file.
