When the ingest utility processes input data, there are three code pages involved: the application (client) code page, the input data code page, and the database code page.
Code page | How specified | Default |
---|---|---|
Application (client) code page, which is used in the CLP command file | Determined from the current locale | Determined from the current locale |
Input data code page | INPUT CODEPAGE on the INGEST command | Application code page |
Database code page | Specified on the CREATE DATABASE command | 1208 (UTF-8 encoding of Unicode) |
If the input data code page differs from the application code page, the ingest utility temporarily overrides the application code page with the input data code page so that DB2® converts the data directly from the input data code page to the database code page. Under some conditions, the ingest utility cannot override the application code page. In this case, the ingest utility converts character data that is not defined as FOR BIT DATA to the application code page before passing it to DB2. In all cases, if the column is not defined as FOR BIT DATA, DB2 converts the data to the database code page.
It is strongly recommended that if a column definition omits FOR BIT DATA, then its corresponding field definition also omit FOR BIT DATA. Likewise, if a column definition specifies FOR BIT DATA, its corresponding field should also specify FOR BIT DATA. Otherwise, the value assigned to the column is unpredictable because it depends on whether the ingest utility can override the application code page.
Field definition | Column definition | Input data (code page 819 ) | Data after the ingest utility converts it to application code page 850 | Data on the server if the ingest utility can override the application code page | Data on the server if the ingest utility cannot override the application code page |
---|---|---|---|---|---|
CHAR | CHAR | X'E9' | X'82' | X'C3A9' | X'C3A9' |
CHAR FOR BIT DATA | CHAR FOR BIT DATA | X'E9' | X'E9' | X'E9' | X'E9' |
CHAR FOR BIT DATA | CHAR | X'E9' | X'E9' | X'C3A9' | X'C39A' ("Ú") |
CHAR | CHAR FOR BIT DATA | X'E9' | X'82' | X'E9' | X'82' |
Conversion is required when... | In this case, conversion from... | To... | Is done by... |
---|---|---|---|
The INGEST command contains strings or SQL identifiers that need to be converted to the input data code page. | Application code page | Input data code page | Ingest utility |
The utility can override the application code page to be the input data code page. | Input code page | Database code page | DB2 |
The utility cannot override the application code page. | Input code page | Application code page | Ingest utility |
The utility cannot override the application code page. | Application code page | Database code page | DB2 |