The following sections describe the rules for assignments. Usually, compatible data objects are assigned without conversion, whereas a type conversion is performed for incompatible data objects. For each assignment between incompatible data objects, the system searches for a suitable conversion rule to carry out the assignment.
If a rule exists for two data types, the two types 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.
If a suitable conversion rule is not found or the content of the source field is not suitable, a syntax errors occurs or an exception is raised.
Conversion rules exist for:
Slightly different rules apply for conversions between
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 and non- Unicode programs programs are also explained.
- In some cases, for comparisons, different rules apply than the usual rules for assignments. In particular, exceptions that can be resolved for assignments, cannot be resolved for comparisons.
EXACTaddition for the
MOVEstatement can be used to perform checks before the conversion is carried out. These ensure that only applicable values are assigned and that no values are lost during the assignment process.
- Checks generally are not made on assignments between compatible data objects. If a data object already contains an invalid value, for example an invalid date or time in a date or time field, then this value is passed just like a valid value if the assignment is being made to a compatible data object.