Defining custom localization values at the data element level

Table 3-4 describes how to define custom localization at the data element level.

Table 3-4: Installing custom values at the data element level

Step

Application step

Purpose

Details

1

Call cs_loc_alloc.

Allocate a CS_LOCALE structure.

This call copies the parent context’s current localization information into the CS_LOCALE structure.

2

Call cs_locale.

Overwrite the CS_LOCALE structure with custom localization values.

For more information about this process, see “The cs_locale routine”.

3

Optionally, call cs_dt_info.

Change datetime conversion formats in the CS_LOCALE structure.

For more information about cs_dt_info, see the Open Client and Open Server Common Libraries Reference Manual.

4

Use the CS_LOCALE structure

Customize a bind variable, destination variable, or routine.

  • Customize a bind variable by using the CS_LOCALE structure in ct_bind’s datafmt parameter.

  • Customize a destination variable by using the CS_LOCALE structure in cs_convert’s destfmt parameter.

  • Customize cs_strcmp or cs_time’s behavior by supplying the CS_LOCALE structure as a parameter to the routine.

5

Optionally call cs_loc_drop.

Deallocate the CS_LOCALE structure.

The application must not deallocate the CS_LOCALE structure until the CS_DATAFMT structure no longer references it.