Localizing a CS_CONTEXT structure

To properly localize a CS_CONTEXT structure for a client thread, an Open Server application must:

  1. Call cs_ctx_alloc to allocate a CS_CONTEXT for the client thread.

  2. Call cs_loc_alloc to allocate a new CS_LOCALE structure.

  3. Call srv_thread_props to copy the client thread’s existing CS_LOCALE structure. This sets the new CS_LOCALE up with the client’s language, and character set.

  4. Call cs_locale with type as CS_SYB_CHARSET to replace the client’s character set with the Open Server’s character set.

  5. Call cs_config with property as CS_LOC_PROP to copy the localization information from the CS_LOCALE into the CS_CONTEXT.

  6. Call cs_loc_drop to deallocate the CS_LOCALE, if desired. An application can also reuse a CS_LOCALE structure, calling cs_locale, if necessary, to change its localization values.