Conversion rules

The following sections describe the rules for type conversion in assignments. Conversion always takes place if data objects are not compatible, which means that not all of their attributes, such as type or length, match. For every assignment between incompatible data objects, an appropriate conversion rule must be found to carry out the assignment. If such a rule exists for two data types, they are convertible. According to a basic rule for all conversions, the content of the source field must represent a meaningful value for the data type of the target field. Conversion rules exist for:

Elementary data types
Structures
Internal tables
Reference variables

The conversion rules explained here generally apply to all statements in which the contents of data objects are changed. Exceptions to these rules are explained for each individual statement. Differences between Unicode programs and non-Unicode programs are also explained.

Note

For comparisons, different conversion rules apply in some cases.