Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

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:

  1. The initial value of CTLNO, that is, '0bbbbbbb' converts to FIXED DECIMAL(15,0).
  2. 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).
  3. This value now converts to a character string of length 18 in preparation for the assignment back to CTLNO.
  4. 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.

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)