Round-trip conversion

A round-trip conversion ensures the integrity of all character data from the source CCSID to the target CCSID and back to the source. Even if the target CCSID does not support a given character, the character regains its original hexadecimal value after it is converted back to the source CCSID.

One alternative to a round-trip conversion is an enforced subset conversion, during which characters that do not exist in the target CCSID are lost. Whether a particular conversion uses a round-trip conversion or an enforced subset conversion depends on how your system is set up to do conversions. For example, in Db2 for z/OS®, many conversions are defined by z/OS Unicode Services. Each of the conversion definitions specifies whether to use a round-trip or enforced subset conversion.

A round-trip conversion works only in a two-tier homogenous environment where the data makes the complete round trip. For example, if you pass data from Db2 for Linux®, UNIX, and Windows to Db2 for z/OS and then back to Db2 for Linux, UNIX, and Windows with a round-trip conversion, no data is lost. The data was converted back to its original format. However, if you have a more complicated environment, a round-trip conversion does not necessarily preserve data integrity. For example, if you pass data from Db2 for z/OS to Db2 for Linux, UNIX, and Windows and then to Linux on a Java™ client, two conversions have potentially occurred. Because the data was not converted back to its original format before the second conversion, data might have been lost even if round-trip conversions are used.

Example

In ASCII CCSID 1252, the trademark symbol ™ is code point X'99'. In EBCDIC CCSID 37, this code point does not exist. During character conversion from ASCII CCSID 1252 to EBCDIC CCSID 37, the trademark symbol is converted to a control character, X'39'. If you use SPUFI to select the data, the data displays as the unprintable character that you specified in your emulator, which is generally a quotation mark (") or a period (.). If you issue a SELECT HEX(column) statement, the data displays as X'39', which is the DEL control character. When the client uses a round-trip conversion to convert this character back to ASCII CCSID 1252, the trademark symbol is preserved as code point X'99'. Notice that this conversion is not lossless unless it is converted back to the original format.