# tibems_SetCodePages

Function

## Purpose

Set code pages for string conversion on EBCDIC platforms (when non-default code pages are required).

## C Declaration

    tibems_status tibems_SetCodePages(
        char* host_codepage,
        char* net_codepage);

## COBOL Call

    CALL "tibems_SetCodePages"
         USING BY REFERENCE host-codepage,
               BY REFERENCE net-codepage,
                  RETURNING TIBEMS-STATUS
    END-CALL.

## Parameters

Parameter | Description
--- | ---
`host_codepage` | Set this code page as the native (EBCDIC) character encoding for the host computer.
`net_codepage` | Set this code page as the ASCII or UTF-8 character set for the network.

## String Conversion

EMS software uses the operating system’s iconv() call to automatically convert strings within messages. Conversion occurs only as needed:

- Programs running in EBCDIC environments represent all strings using an EBCDIC code page (called the host code page). Before sending a message, the EMS client library converts its strings to an ASCII or UTF-8 character set (the network code page).
- Conversely, when a message arrives from the network, the EMS client library converts its strings to the EBCDIC host code page before presenting the message to the program.

## Remarks

This call sets the host and network code pages for string conversions in EBCDIC environments.

Call this function when the system code pages differ from the EMS default code pages (see the table of Default Code Pages). Throughout an enterprise, all sending and receiving programs must use the same code pages.

Both arguments are string names of code pages. To determine valid code page names for your operating system, see documentation from the operating system vendor.

Programs may call this function at most once. The call must precede the first call to any message function, and the arrival of the first message from the network.

Tip: On IBM i, note that:

- Arguments are 5 character Coded Character Set Identifiers (CCSID) and must be null-terminated.
- Only the first call to this function within an activation group has any affect on the code pages.

## Default Code Pages

To use a default code page, programs may supply NULL for either parameter. Using the default code pages in both parameter positions has the same effect as not calling this function at all.

Default Host Code Page | Default Network Code Page
--- | ---
On z/OS: `"IBM-1047"` On IBM i, the default is the CCSID of the job. | `"ISO8859-1"`

## See Also

Strings and Character Encodings

Copyright © Cloud Software Group, Inc. All rights reserved.