The following examples illustrate some uses for the ALPHABET clause.
77 ITEM-1 PIC X(3) VALUE "ABC".
77 ITEM-2 PIC X(3) VALUE "DEF".
IF ITEM-1 > ITEM-2
Characters D, E, and F are in ordinal positions 1, 2, and 3 of this collating sequence. Characters A, B, and C are in ordinal positions 197, 198, and 199 of this collating sequence.
77 ITEM-1 PIC X(3) VALUE HIGH-VALUE.
77 ITEM-2 PIC X(3) VALUE "789".
IF ITEM-1 = ITEM-2 . . .
IF ITEM-2 = HIGH-VALUE . . .
They compare as true because the values “7”, “8”, and “9” all occupy the same position (HIGH-VALUE) in this USER-SEQUENCE collating sequence.
05 TABLE A OCCURS 6 ASCENDING KEY IS
KEY-A INDEXED BY INX-A.
10 FIELD-A ...
10 KEY-A ...
and if the contents in ascending sequence of each occurrence of KEY-A are A, B, C, D, E, G, then the results of the execution of a SEARCH ALL statement for this table will be invalid because the contents of KEY-A are not in ascending order. The proper ascending order would be E, D, A, B, C, G.