ILE RPG Language Reference


Conversions

Conversion between character and double-byte graphic fields consists of adding or removing shift-out and shift-in bracketing and possibly performing CCSID conversion on the graphic data.

When 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. However, in the following scenarios, the conversion built-in functions do not have to be specified; the compiler will do the conversions implicitly when necessary:

Comparison
Both operands are converted to UCS-2 before comparison.
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.
Note:
While implicit conversion is supported for the result of a concatenation expression, all the operands of the concatenation expression must have the same type and CCSID.

[ Top of Page | Previous Page | Next Page | Contents | Index ]