THE SIMPLE SORT VERB:
The process of sequencing the records in some preferred manner is termed as sorting. The Sorting is done upon some key data item in the record. For illustration, consider the case of a pay roll file where each record consist all the essential information of an employee, like his name, identification number, address, department number, allowances, basic pay, deductions, etc.
Whenever a sequential file is to be sorted, its record exists on the file medium and can be accessed serially. In COBOL, there is no specific feature for the sorting of a table.
Though, its gives a sort verb which can be used to SORT a sequential file. In addition to sort verb, the MERGE verb can be used to merge various sorted files to create a new file containing the records of these files in the sorting order.
The sort verb such as many other COBOL verbs, then have various forms. This form is to be used when it is needed to sort a given input file. The simple sort verb needs the naming of three files - the unsorted input file, sorted output file and the work file. The format of the common SORT verb is as shown below: