The following figures show the source to code a packed decimal data type in ILE C and ILE C++:
Figure 213. ILE C Source Code to Port Code to a Packed Decimal Data Type
// ILE C program #include <decimal.h> void main() { int dig, prec; decimal(9,3) d93; dig = digitsof(d93); prec = precisionof(d93); } |
Figure 214. ILE C++ Source Code to Port Code a Packed Decimal Data Type
// C++ program #include <bcd.h> void main() { int dig, prec; _DecimalT<9,3> d93; dig = d93.DigitsOf(); prec = d93.PrecisionOf(); } |
The following figure shows you that by using the macros defined in <bcd.h>, you can use the same ILE C shown in the first program:
Figure 215. Example of Using BCD Macros to Port Code to ILE C++
// C++ program using the macro #include <decimal.h> void main() { int dig, prec; decimal(9,3) d93; dig = digitsof(d93); prec = precisionof(d93); } |
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.