Collating Sequence




Collating Sequence

Data processing operations often use alphanumeric and alphabetic data elements. Obviously, we do not intend to perform any arithmetic operation on such data, but we frequently perform comparison operations on them, like arranging them in some desired sequence. Now, if we want a computer to compare alphabetic values A and B, which one will the computer treat as greater. Answering such questions necessitates having some assigned ordering among the characters used by a computer. This is known as collating sequence. Data processing operations mostly adopt case dicitionary collating sequence.

Collating sequence may vary from the one computer system to another depending on the type of character coding scheme (computer code) used by a computer. To illustrate this, let us consider the computer codes already discussed in this chapter. Observe from Figures 4.2 and 4.3 that the zone values of character A through 9 increases in characters (A,B,...,Z) to be greater than numeric characters (0,1, ...9), while computer that uses EBCDIC will treat numeric characters to be greater than alphabetic similarly, observe from Figures 4.6 that during a sort (ascending), a computer using ASCII will place numbers ahead of letters because numbers have values less than that for letters. Due to similar reason, it will place uppercase letters ahead of lowercase letters.

However, whatever may be the type of computer code used, in most collating sequences, following rules are observed:-

Letters are considered in alphabetic order (A < B < C <... < Z) AND (a < b < c <... < z)

Digits are considered in numeric order (0 < 1 < 2 <... < 9).