Controlling the alphanumeric collating sequence with a locale
The collating sequence for single-byte alphanumeric characters for the program collating sequence is based on either the locale at compile time or the locale at run time.
About this task
If you specify PROGRAM COLLATING SEQUENCE
in
the source program, the collating sequence is set at compile time
and is used regardless of the locale at run time. If instead you set
the collating sequence by using the COLLSEQ
compiler
option, the locale at run time takes precedence.
If
the code page in effect is a single-byte ASCII code page, you can
specify the following clauses in the SPECIAL-NAMES
paragraph:
ALPHABET
clauseSYMBOLIC CHARACTERS
clauseCLASS
clause
If you specify these clauses when the source code page in effect includes DBCS characters, the clauses will be diagnosed and treated as comments. The rules of the COBOL user-defined alphabet-name and symbolic characters assume a character-by-character collating sequence, not a collating sequence that depends on a sequence of multiple characters.
If
you specify the PROGRAM COLLATING SEQUENCE
clause
in the OBJECT-COMPUTER
paragraph, the collating sequence
that is associated with the alphabet-name is used
to determine the truth value of alphanumeric comparisons. The PROGRAM
COLLATING SEQUENCE
clause also applies to sort and merge
keys of USAGE DISPLAY
unless you specify the COLLATING
SEQUENCE
phrase in the SORT
or MERGE
statement.
If
you do not specify the COLLATING SEQUENCE
phrase
or the PROGRAM COLLATING SEQUENCE
clause, the collating
sequence in effect is NATIVE
by default, and it is
based on the active locale setting. This setting applies to SORT
and MERGE
statements
and to the program collating sequence.
The collating sequence affects the processing of the following items:
ALPHABET
clause (for example, literal-1THRU
literal-2)SYMBOLIC CHARACTERS
specificationsVALUE
range specifications for level-88 items, relation conditions, andSORT
andMERGE
statements
Specifying the collating sequence
Controlling the collating sequence with a locale
Controlling the DBCS collating sequence with a locale
Controlling the national collating sequence with a locale
Setting sort or merge criteria
COLLSEQ
Classes and categories of data (COBOL for Linux® on x86 Language Reference)
Alphanumeric comparisons (COBOL for Linux on x86 Language Reference)