When you begin a sort, you must specify the keys, the place
where records will be compared. Then, the keys of each record are
compared and put into a hierarchichal arrangment. The resulting
arrangement depends two things: the sequence and the order. You
must specify both.
The sequence determines what follows what: for example, 0,1,2,...,9
in digits. There are predefined sequences, like the standard alphanumeric
ones, or you can create your own.
Sequencing depends on the data type of the key. You pass the type in one field
of the keys parameter. Number type keys are sorted in standard
numeric order. ASCII or EBCDIC byte types (type 0 in the keys
parameter) are sorted in their own sequences, shown in Appendix C.
You can, however, vary the sequence of byte types if you wish.
You may want an alphabetic sequence that is not case sensitive.
For example, you may want "AaBbCc..." instead of the ASCII sequence
of "ABC ... abc". You may want your EBCDIC data sorted ignoring hyphens
and punctuation, or with the digits before the letters.
The order determines which end of the sequence will come first.
There are two options: ascending or descending. For example, the
digits in ascending order are: 0,1,2,...,9; the digits in descending
order are: 9,8,7,...,0.
NOTE: When performing Native Language (NL) functions, alphanumeric
sorting and merging needs to be done using the specifics of the native
language. See the end of this chapter for more information.