When you convert a value of a packed decimal type to an integer type, the value becomes a packed decimal (20,0), which then becomes an integer type. High-order bits will be truncated depending on the size of the integer type. No run-time exception occurs when assigning a packed decimal to an integer type that results in truncation of the integral part.
Examples:
The following example shows the conversion from a packed decimal type that has a fractional part to an integer type.
Figure 276. ILE C Source to Convert a Packed Decimal with a Fractional Part to an Integer
|
The following example shows the conversion from a packed decimal type that has less than 10 digits in the integral part to an integer type.
|
The following example shows the conversion from a packed decimal type that has more than 10 digits in the integral part to an integer type.
|
The following example shows conversion from a packed decimal type that has a fractional part, and an integral part having more than 10 digits to an integer type.
|
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.