Conversions

Start of changeWhen you use character, graphic, and UCS-2 values with different types or CCSIDs in the same operation, conversions must be done to ensure that all the values have the same type and CCSID. The conversions can be done explicitly, using the conversion built-in functions %CHAR, %UCS2 or %GRAPH or the MOVE or MOVEL operation. However, in the following scenarios, the compiler will do the conversions implicitly when necessary:
Comparison
Start of changeThe comparison is done using a Unicode CCSID. If one or both of the operands is not already in that CCSID, the operand is converted to a temporary with that CCSID.End of change
Assignment
The source value is converted to the type and CCSID of the target value.
Parameters passed by value and by read-only reference
The passed parameter is converted to the type and CCSID of the prototyped parameter.
Concatenation
If one of the operands is a hexadecimal literal the other operand must also be of type character; in this case the hexadecimal literal will be considered to have the same CCSID as the other operand. Otherwise, the operands are converted to a Unicode CCSID.
End of change
Start of changeWhen operands are converted to a Unicode CCSID, the following rules are used to determine the exact Unicode CCSID to use End of change
Warning: Start of change See CCSIDCVT(*EXCP | *LIST) for more information about substitution characters and the CCSIDCVT keyword.End of change