Using a CS_LOCALE structure

A CS_LOCALE structure defines localization values. An application uses the CS_LOCALE structure to define custom localization values at the context, connection, and data element levels.

To do this, an application:

  1. Calls cs_loc_alloc to allocate a CS_LOCALE structure.

  2. Calls cs_locale to load the CS_LOCALE with custom localization values. Depending on what parameters it is called with, cs_locale may search for the LC_ALL, LC_CTYPE, LC_COLLATE, LC_MESSAGE, LC_TIME or LANG environment variables.

  3. Uses the CS_LOCALE. An application:

    • Calls cs_config with property as CS_LOC_PROP to copy the custom localization values into a context structure.

    • Calls ct_con_props with property as CS_LOC_PROP to copy the custom localization values into a connection structure. Note that because CS_LOC_PROP is a login property, an application cannot change its value after a connection is open.

    • Supplies the CS_LOCALE as a parameter to a routine that accepts custom localization values (cs_strcmp, cs_time).

    • Includes the CS_LOCALE in a CS_DATAFMT structure describing a destination program variable (cs_convert, ct_bind).

  4. Calls cs_loc_drop to deallocate the CS_LOCALE.