DDS-to-C/C++ Data Type Mapping

The following table shows DDS data types and the corresponding ILE C/C++ declarations that are used to map fields from externally described files to your ILE C/C++ program. The ILE C/C++ compiler creates fields in structure definitions based on the DDS data types in the externally described file.

Table 7. DDS-to-C/C++ Data Type Mappings
DDS Data Type Length Decimal Position C/C++ Declaration
Indicator 1 0 char INxx_INyy[n]; for unused indicators xx through yy char INxx; for used indicator xx
A - alphanumeric 1-32766 none char field[n]; (where n = 1 to 32766)
A - alphanumeric variable length VARLEN keyword 1-32740 none
_Packed struct { short len;
                    char data[n];
                  } field;
where n is the maximum length of field
B - binary 1-4 0 short int field;
B - binary 1-4 1-4 char field[2];
B - binary 5-9 0 int field;
B - binary 5-9 1-9 char field[4];
H - hexadecimal 1 none char field;
H - hexadecimal 2-32766 none char field[n]; (where n = 2 to 32766)
H - hexadecimal variable length VARLEN keyword 1-32740 none _Packed struct { short len; char data[n]; } field; where n is the maximum length of field
G - graphic variable length VARLEN keyword 4-1000 none _Packed struct { short len; wchar_t data[n]; } field; (where n = 4 to 1000)
P - packed decimal 1-31 0-31 decimal (n,p) where n is length and p is decimal position on option d
S - zoned decimal 1-31 0-31 char field[n]; (where n = 1 to 31)
F - floating point  1   1  float field;
F - floating point  1   1  double field;
J - DBCS only 4-32766 none char field[n]; (where n = 4 to 32766 and n is an even number)
E - DBCS either 4 - 32766 none char field[n]; (where n = 4 to 32766 and n is an even number)
O - DBCS open 4 - 32766 none char field[n]; (where n = 4 to 32766)
J - DBCS only variable length VARLEN keyword 4-32740 none _Packed struct { short len; char data[n]; } field; (where n = 4 to 32740 and n is an even number)
E - DBCS either variable length VARLEN keyword 4-32740 none _Packed struct { short len; char data[n]; } field; (where n = 4 to 32740 and n is an even number)
O - DBCS open variable length VARLEN keyword 4-32740 none
_Packed struct { short len;
                       char data[n];
                     } field;
(where n = 4 to 32740)
T - time 8 none char field[8];
L - date 6, 8, or 10 none char field[n]; (where n = 6, 8 or 10)
Z - time stamp 26 none char field[26];
Note:
 1 The C declaration (float or double) is based on what is specified in the FLTPCN (floating-point precision) keyword in the DDS: *SINGLE (default) is float, *DOUBLE is double.

You can find more information in the DDS Reference, available in PDF and HTML formats from the i5/OS Information Center Web site at:

    http://www.ibm.com/systems/i/infocenter


[ Top of Page | Previous Page | Next Page | Contents | Index ]