The ILE C/C++ compiler and library supports packed decimal data.
The d option of the #pragma mapinc directive causes the compiler to generate packed decimal variables for any packed decimal fields defined in the DDS file. If you use the p option of the #pragma mapinc directive or the PKDDECFLD parameter of the GENCSRC command, character arrays are generated to store the packed decimal values.
C++ users must use the GENCSRC utility to create type definitions from an
external file.
C users can use either the GENCSRC utility or the #pragma mapinc
directive to create type definitions from an external file.
These character arrays then need to be converted to an ILE C/C++ numeric data type to be used in the ILE C/C++ program. If neither the d or p option is specified, the d option is the default. See Chapter 26, Using Packed Decimal Data in a C Program or Chapter 27, Using Packed Decimal Data in a C++ Program for examples in using packed decimal data types.
Use either the #pragma mapinc d option or the GENCSRC PKDDECFLD parameter in your ILE C/C++ source code.
To convert packed decimal data that is stored in character arrays to integer or floating point (double) and vice versa, the functions QXXDTOP(), QXXITOP(), QXXPTOD(), QXXPTOI() can be used.
To convert zoned decimal data that is stored in character arrays to integer or floating point (double) and vice versa, the functions QXXDTOZ(), QXXITOZ(), QXXZTOD,() and QXXZTOI() can be used.
The MI cpynv() function can also be used to convert packed or zoned decimal data to an ILE C/C++ numeric data type. It can be used to convert an ILE C/C++ numeric data type to packed or zoned decimal data.
The conversion functions are included with the ILE C/C++ compiler so that EPM C code that uses these functions can be maintained.
If you are doing database I/O operations, you can use a logical file with integer or floating point fields to redefine packed and zoned fields in your physical file. When you perform an input, or output operation through the logical file, the iSeries 400 system converts the data for you automatically.
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.