You can arrange records in a particular sequence by using a SORT or MERGE statement. You can mix SORT and MERGE statements in the same COBOL program.
A program can contain any number of sort and merge operations. They can be the same operation performed many times or different operations. However, one operation must finish before another begins.
The steps you take to sort or merge are generally as follows:
related concepts
Sort and merge process
related tasks
Describing the sort or merge file
Describing the input to sorting or merging
Describing the output from sorting or merging
Requesting the sort or merge
Determining whether the sort or merge was successful
Stopping a sort or merge operation prematurely
related references
SORT statement
(COBOL for Windows Language Reference)
MERGE statement
(COBOL for Windows Language Reference)