The active locale

A locale is a collection of data that encodes information about a cultural environment. The active locale is the locale that is in effect when you compile or run your program. You can establish a cultural environment for an application by specifying the active locale.

Only one locale can be active at a time.

The active locale affects the behavior of these culturally sensitive interfaces for the entire program:

  • Code pages used for character data
  • Messages
  • Collating sequence
  • Date and time formats
  • Character classification and case conversion

The active locale does not affect the following items, for which 85 COBOL Standard defines specific language and behavior:

  • Decimal point and grouping separators
  • Currency sign

The active locale determines the code page for compiling and running programs:

  • The code page that is used for compilation is based on the locale setting at compile time.
  • The code page that is used for running an application is based on the locale setting at run time.

The evaluation of literal values in the source program is handled with the locale that is active at compile time. For example, the conversion of national literals from the source representation to UTF-16 for running the program uses the compile-time locale.

COBOL for Linux® determines the setting of the active locale from a combination of the applicable environment variables and system settings. Environment variables are used first. If an applicable locale category is not defined by environment variables, COBOL uses defaults and system settings.