The SORT statement accepts records from one or more files, sorts them according to the specified key(s), and makes the sorted records available either through an OUTPUT PROCEDURE or in an output file. See also "MERGE Statement" in topic 6.2.23. The SORT statement can appear anywhere in the Procedure Division except in the declarative portion.
___ Format __________________________________________________________________________________ | | | <__________________________________________________ | | <_____________ | | | >>__SORT__file-name-1____ ____ __ _ASCENDING__ __ _____ ____data-name-1_|_|_______________> | | |_ON_| |_DESCENDING_| |_KEY_| | | | | >__ _________________________________________ ____________________________________________> | | |_ ______ __DUPLICATES__ ____ __ _______ _| | | |_WITH_| |_IN_| |_ORDER_| | | | | >__ __________________________________________________ ___________________________________> | | |_ ___________ __SEQUENCE__ ____ __alphabet-name-1_| | | |_COLLATING_| |_IS_| | | | | <_____________ | | >__ _USING____file-name-2_|_______________________________________________________ _______> | | |_INPUT PROCEDURE__ ____ __procedure-name-1__ _______________________________ _| | | |_IS_| |_ _THROUGH_ __procedure-name-2_| | | |_THRU____| | | | | <_____________ | | >__ _GIVING____file-name-3_|_______________________________________________________ _____>< | | |_OUTPUT PROCEDURE__ ____ __procedure-name-3__ _______________________________ _| | | |_IS_| |_ _THROUGH_ __procedure-name-4_| | | |_THRU____| | | | |_____________________________________________________________________________________________|
No pair of file-names in a SORT statement can be specified in the same SAME SORT AREA, or SAME SORT-MERGE AREA clause. File-names associated with the GIVING clause (file-name-3...) cannot be specified in the SAME AREA clause.
Subtopics:
Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.