When data conversion occurs, conversion will take place from a source
code page to a target code page.
The source code page is determined from the source of the data.
In general, data from the application has a source code page equal
to the application code page, and data from the database has a source
code page equal to the database code page.
The determination of target code page is more involved; where the
data is to be placed, including rules for intermediate operations,
is considered:
- In general, if the data is moved directly from an application
into a database, with no intervening operations, the target code page
is the database code page.
- If the data is derived from operations performed on character
data, and the source is the application code page, the database code
page, FOR BIT DATA, or FOR BLOB data, data conversion is based on
a set of rules. Some or all of the data items might have to be converted
to an intermediate result, before the final target code page can be
determined.
Note: Code page conversions between multibyte code pages, for example
DBCS and EUC, might result in either an increase or a decrease in
the length of the string.
Character substitutions during code page conversions
When
your application converts from one code page to another, it is possible
that one or more characters are not represented in the target code
page. If this occurs, DB2® inserts
a substitution character into the target string in place of
the character that has no representation. The replacement character
is then considered a valid part of the string. In situations where
a substitution occurs, the SQLWARN10 indicator in the SQLCA is set
to 'W'.
Note: Any character conversions resulting from using
the WCHARTYPE CONVERT precompiler option will not flag a warning if
any substitutions take place.