Joined: 01 Jul 2005
cobol has inbuilt facility to sort fles
Example syntax can be as follows:
SORT WORK-FILE ON ASCENDING KEY DATA-NAME1
DESCENDING KEY DATA-NAME2
USING INPUTFILE GIVING OUTPUTFILE.
Where WORK-FILE is the file defined using SD entry.
INPUTFILE is the input unsorted file which remains unchanged after sorting, and OUTPUTFILE is the final sorted file.
you can sort the file on ascending or descending keys for even more than one key.
Please search the forum for detailed answers. I am sure there will be a number of posts regarding this.