A locale is a collection of language-specific and culture-specific conventions for information processing. A locale makes information about language and culture available at run time so that the same program or method can display or process data differently for different countries or cultures.
See the COBOL for Windows Programming Guide for additional information about locales and the details of setting locales for specific languages and cultures.
In general, the COBOL run time determines the locale in effect when the COBOL application is activated. However, the following processing is based on the locale in effect at compile time:
The compiler uses the code page indicated by the locale in effect at compile time to evaluate the source program. This includes the evaluation of user-defined names and literal values.
When a literal value is associated with a data item such that code page conversion is required, the code page in effect at run time is used for the data item. For an item of class alphanumeric with native ASCII encoding, the code page indicated by the locale in effect at run time is used. For an item of class alphanumeric with EBCDIC encoding, the EBCDIC code page in effect at run time is used.
When the COLLSEQ(LOCALE) compiler option or the NCOLLSEQ(LOCALE) compiler option is in effect, the compile-time locale determines the following values:
The following sections describe the effects of locales on COBOL runtime processing.
The runtime locale is used to determine:
Two runtime code pages can be in effect: one for native data (non-EBCDIC data) and one for host data (EBCDIC data). The COBOL for Windows Programming Guide explains how these runtime code pages are determined.
In general, COBOL for Windows uses the collating sequence defined by the runtime locale when the COLLSEQ(LOCALE) compiler option or the NCOLLSEQ(LOCALE) compiler option is in effect. COLLSEQ(LOCALE) affects alphanumeric and DBCS data items; NCOLLSEQ(LOCALE) affects items described with USAGE NATIONAL.
When COLLSEQ(BINARY) or NCOLLSEQ(BINARY) is specified, a binary collating sequence is used.
In some cases, the language rules specify the use of a non-locale collating sequence regardless of the setting of the COLLSEQ or NCOLLSEQ compiler option. For example:
COBOL for Windows supports locales for certain combinations of language, country, and code page. System environment variables identify the runtime locale in effect for specific locale categories. See the COBOL for Windows Programming Guide for details.