Conversion rules for string assignment

A character or graphic string that is assigned to a column or variable is first converted, if necessary, to the coded character set of the target. Conversion is necessary only if certain conditions apply.

Conversion is necessary only if all the following are true:

  • The CCSIDs of string and target are different.
  • Neither CCSID is X'FFFF' (neither the string nor the target is defined as BIT data).
  • The string is neither null nor empty.

An error occurs if:

  • The SYSSTRINGS table is used but contains no information about the pair of CCSIDs and DB2® cannot do the conversion through z/OS® support for Unicode.
  • A character of the string cannot be converted and the operation is assignment to a column or to a host variable that has no indicator variable. For example, a DBCS character cannot be converted to a variable with an SBCS CCSID.

A warning occurs if:

  • A character of the string is converted to a substitution character. A substitution character is the character that is used when a character of the source character set is not part of the target character set. For example, assuming an EBCDIC target character set, if the source character set includes Katakana characters and the target character set does not, a Katakana character is converted to the EBCDIC SUB X'3F'.
  • A character of the string cannot be converted and the operation is assignment to a variable that has an indicator variable. For example, a DBCS character cannot be converted if the variable has an SBCS CCSID. In this case, the string is not assigned to the variable and the indicator variable is set to -2.