ASCENDING/DESCENDING KEY Phrase

This phrase specifies that records are to be processed in an ascending or descending sequence (depending on the phrase specified), based on the specified merge keys.
data-name-1
Is a key data-name. Records are processed in ascending or descending order on this key.

Data-name-1 specifies the KEY data item on which the merge is based. Each such data-name identifies a data item in a record associated with file-name-1. The data-names following the word KEY are listed from left to right in the MERGE statement in order of decreasing significance without regard to how they are divided into KEY phrases. The left-most data-name is the major key, the next data-name is the next most significant key, and so forth.

The following rules apply:
IBM Extension
End of IBM Extension
The direction of the merge operation depends on the specification of the ASCENDING or DESCENDING keywords as follows:
IBM Extension
End of IBM Extension

The key comparisons are performed according to the rules for comparison of operands in a relation condition (see Relation Condition).