Controlling the collating sequence with a locale
Various operations such as comparisons, sorting, and merging use the collating sequence that is in effect for the program and data items. How you control the collating sequence depends on the code page in effect for the class of the data: alphabetic, alphanumeric, DBCS, or national.
About this task
A
locale-based collating sequence for items that are class
alphabetic, alphanumeric, or DBCS applies only when the COLLSEQ(LOCALE)
compiler
option is in effect, not when COLLSEQ(BIN)
or COLLSEQ(EBCDIC)
is
in effect. Similarly, a locale-based collating sequence
for class national items applies only when the NCOLLSEQ(LOCALE)
compiler
option is in effect, not when NCOLLSEQ(BIN)
is in
effect.
If the COLLSEQ(LOCALE)
or NCOLLSEQ(LOCALE)
compiler
option is in effect, the compile-time locale is used for language
elements that have syntax or semantic rules that are affected by locale-based
collation order, such as:
THRU
phrase in a condition-nameVALUE
clause- literal-3
THRU
literal-4 phrase in theEVALUATE
statement - literal-1
THRU
literal-2 phrase in theALPHABET
clause - Ordinal positions
of characters specified in the
SYMBOLIC CHARACTERS
clause THRU
phrase in theCLASS
clause
If the COLLSEQ(LOCALE)
compiler
option
is in effect, the collating sequence for alphanumeric keys in SORT
and MERGE
statements
is always based on the runtime locale.
Specifying the collating sequence
Setting sort or merge criteria
Specifying the code page for character data
Using environment variables to specify a locale
Controlling the alphanumeric collating sequence with a locale
Controlling the DBCS collating sequence with a locale
Controlling the national collating sequence with a locale
Accessing the active locale and code-page values