A conversion error
dcl Ctlno char(8) init('0');
do I=1 to 100;
Ctlno=Ctlno+1;
·
·
·
end;
For this example, FIXED DECIMAL precision 15 was used for the
implementation maximum. The example raises the CONVERSION condition
because of the following sequence of actions:
- The initial value of CTLNO, that is, '0bbbbbbb' converts
to FIXED DECIMAL(15,0).
- The decimal constant, 1, with attributes FIXED DECIMAL(1,0),
is added; in accordance with the rules for addition, the precision
of the result is (16,0).
- This value now converts to a character string of length 18 in
preparation for the assignment back to CTLNO.
- Because CTLNO has a length of 8, the assignment causes truncation
at the right; thus, CTLNO has a final value that consists entirely
of blanks. This value cannot be successfully converted to arithmetic
type for the second
iteration of the loop.
|
This information center is powered by Eclipse technology. (http://www.eclipse.org)