To set sort or merge criteria, define the keys on which the operation is to be performed.
Do these steps:
Specify the names of the keys in decreasing order of significance. The leftmost key is the primary key. The next key is the secondary key, and so on.
SORT and MERGE keys can be of class alphabetic, alphanumeric, national (if the compiler option NCOLLSEQ(BIN) is in effect), or numeric (but not numeric of USAGE NATIONAL). If it has USAGE NATIONAL, a key can be of category national or can be a national-edited or numeric-edited data item. A key cannot be a national decimal data item or a national floating-point data item.
The collation order for national keys is determined by the binary order of the keys. If you specify a national data item as a key, any COLLATING SEQUENCE phrase in the SORT or MERGE statement does not apply to that key.
You can mix SORT and MERGE statements in the same COBOL program. A program can perform any number of sort or merge operations. However, one operation must end before another can begin.
related tasks
Controlling the collating sequence with a locale
related references
NCOLLSEQ
SORT statement
(COBOL for Windows Language Reference)
MERGE statement
(COBOL for Windows Language Reference)