When an expression is evaluated, the target attributes usually are partly derived from the source, partly from the operation being performed, and partly from the attributes of a second operand. Some defaults may be used, and some implementation restrictions (for example, maximum precision) and conventions exist. An intermediate result can undergo conversion if a further operation is performed. After an expression is evaluated, the result can be further converted for assignment to a variable or pseudovariable. These conversions follow the same rules as the conversion of programmer-defined data, for example:
declare A character(8),
B fixed decimal(3,2),
C fixed binary(10);
A = B + C;
During the evaluation of the expression B + C and during the assignment of that result, there are four different results:
The attributes of the first result are determined from the attributes of the source B, from the operator, and from the attributes of the other operand. If one operand of an arithmetic infix operator is binary, the other is converted to binary before evaluation.
The attributes of the second result are determined from the attributes of the source (C and the converted representation of B).
The attributes of the third result are determined in part from the source (the second result) and in part from the attributes of the eventual target A. The only attribute determined from the eventual target is DECIMAL (a binary arithmetic representation must be converted to decimal representation before it can be converted to a character value).
The attributes of A are known from the DECLARE statement.