Attributes are shown in the following table.
Attribute | Field number |
Description |
---|---|---|
Reserved | 1 | Always zero |
Column Name | 2 | Character string |
Alias | 3 | Character string |
Precision | 4 | Numeric value |
Scale | 5 | Numeric value |
Length | 6 | Numeric value |
Host Type | 7 | Keyword representing the host data type |
OLE DB Type | 8 | Keyword representing the local OLE DB data type |
Nullable | 9 | Y or N |
CCSID | 10 | Numeric value |
Title | 11 | Character string |
The precision must be set the same as the length attribute for CHAR and BINARY keyword data types, and set to zero for the other types. (Note that under ODBC, the precision was also used to indicate the length of nonnumeric data types including character, date, time, and binary data types.) Precision has no default value and must not be left null.
Host type name | Keyword | Comment |
---|---|---|
Binary | BINARY | Fixed-length binary data (no character code conversions). The length must be specified. |
Character | CHAR | Fixed-length character data. The length must be specified. |
Date | DATE | The date represented as character data in the format yyyy-mm-dd that fits in 10 bytes |
DBCS - only | DBCS | Fixed-length character data that contain only DBCS data. |
DCBS - Mixed Either | MIXED_EITHER | Fixed-length character data that can contain either DBCS or alphanumeric data. |
DCBS - Mixed Open | MIXED_OPEN | Fixed-length character data that can contain both DBCS and alphanumeric data. DBCS data is distinguished from alphanumeric data with shift-control characters. |
DBCS - Variable Only | VARDBCS | Variable-length character data with a prefix of 2 bytes for length that contains only DBCS data. The maximum possible length for the column containing this data type must be specified. |
DCBS - Variable Mixed Either | VARMIXED_EITHER | Variable-length character data with a prefix of 2 bytes for length that can contain either DBCS or alphanumeric data. The maximum possible length for the column containing this data type must be specified. |
DCBS - Variable Mixed Open | VARMIXED_OPEN | Variable-length character data with a prefix of 2 bytes for length that can contain both DBCS and alphanumeric data. DBCS data is distinguished from alphanumeric data with shift-control characters. The maximum possible length for the column containing this data type must be specified. |
Double | DOUBLE | Floating-point data that fits in 8 bytes (64 bits) |
Long | LONG | Integer data that fits in 4 bytes (32 bits) |
Long Variable Binary | LONGVARBINARY | Variable-length binary data represented as an unsigned character array with prefix 2 bytes for length. The maximum possible length for the column containing this data type must be specified. |
Long Variable Character | LONGVARCHAR | Variable-length character data with a prefix of 2 bytes for the length. The maximum possible length for the column containing this data type must be specified. |
Packed | PACKED | Packed decimal numeric data where the precision, and scale are exactly as specified. |
Short | SHORT | Integer data that fits in 2 bytes (16 bits) |
Single | SINGLE | Floating-point data that fits in 4 bytes (32 bits) |
Time | TIME | The time represented as character data in the format hh:mm:ss that fits in 8 bytes |
Time Stamp | TIMESTAMP | Timestamp represented as characters in the format yyyy-mm-dd hh:mm:ss.ffffff that fits in 19 bytes |
Variable Binary | VARBINARY | Variable-length binary data represented as an unsigned character array with prefix 2 bytes for length. The maximum possible length for the column containing this data type must be specified. |
Variable Character | VARCHAR | Variable-length character data with a prefix of 2 bytes for length. The maximum possible length for the column containing this data type must be specified. |
Zoned | ZONED | Zoned decimal numeric data where the precision and scale are exactly as specified. |
Note that the OLE DB provider limits the maximum length character field that can be accessed on an AS/400 machine to 32,745. Attempting to access a character field greater than this length on an AS/400 machine can have unpredictable results and can cause the OLE DB Provider to hang.
Note that the floating-point data format assumed by the OLE DB Provider for AS/400 and VSAM depends on the host. For AS/400, the host floating-point data format is assumed to be IEEE. On mainframe hosts, floating-point data types are assumed to be in IBM floating-point formats. Since OLE DB supports the IEEE floating-point format, data conversion errors can occur when converting the extreme values of VSAM floating-point data in IBM format to IEEE floating-point data by the OLE DB provider.
Note that the DECIMAL, FLOAT, INTEGER, NUMERIC, REAL, and SMALLINT keywords should not be used in HCD files and should be replaced with the newer keywords as follows:
The DOUBLE keyword replaces the FLOAT keyword.
The LONG keyword replaces the INTEGER keyword.
The PACKED keyword replaces the NUMERIC keyword.
The SHORT keyword replaces the SMALLINT keyword.
The SINGLE replaces the REAL keyword.
The ZONED keyword replaces the DECIMAL keyword.
The SNA OLE DB Management Console snap-in will not work properly with HCD files containing these older keywords and will give unpredictable results.
For the decimal and numeric host data types, the OLE DB Type attribute must be set to DBTYPE_STR. These two fixed-point numeric types are currently converted to character data strings by the DDM layer of the Microsoft OLE DB Provider for AS/400 and VSAM. If these host types are converted to any of the defined OLE DB numeric C types, then numeric accuracy can be lost.
The allowable types are as follows:
OLE DB type name | Keyword | Comment |
---|---|---|
DBTYPE_BYTES | BINARY | Fixed-length binary data represented as an unsigned char array |
DBTYPE_DBDATE | DATE | The OLE DB DBDATE typedef struct as defined in the OLEDB.H header file |
DBTYPE_DBTIME | TIME | The OLE DB DBTIME typedef as defined in the OLEDB.H header file |
DBTYPE_DECIMAL | DECIMAL | The OLE DB DECIMAL typedef struct as defined in the OLEDB.H header file. |
DBTYPE_NUMERIC | NUMERIC | The OLE DB NUMERIC typedef struct as defined in the OLEDB.H header file. |
DBTYPE_DBTIMESTAMP | TIMESTAMP | The OLE DB DBTIMESTAMP typedef struct as defined in the OLEDB.H header file |
DBTYPE_I2 | SHORT | Integer data stored in 2 bytes (16 bits) |
DBTYPE_I4 | LONG | Integer data stored in 4 bytes (32 bits) |
DBTYPE_R4 | FLOAT | Floating-point data stored in 4 bytes (32 bits) |
DBTYPE_R8 | DOUBLE | Floating-point data stored in 8 bytes (64 bits) |
DBTYPE_STR | CHAR | Character data |
DBTYPE_I1 | Not supported (signed tiny integer stored in one byte, 8 bits) | |
DBTYPE_I8 | Not supported (signed long long integer stored in eight bytes, 64 bits) | |
DBTYPE_UI1 | Not supported (unsigned tiny integer stored in one byte, 8 bits) | |
DBTYPE_UI2 | Not supported (unsigned short integer stored in two bytes, 16 bits) | |
DBTYPE_UI4 | Not supported (unsigned long integer stored in four bytes, 32 bits) | |
DBTYPE_UI8 | Not supported (unsigned long long integer stored in eight bytes, 64 bits) |
If the CCSID is set to 0 or 65535 then no character translation will take place when converting character data from the host to the PC by the OLE DB Provider. The allowable values for CCSID are as follows:
EBCDIC character set | CCSID value |
---|---|
U.S./Canada | 37 |
Germany | 273 |
Denmark/Norway | 277 |
Finland/Sweden | 278 |
Italy | 280 |
Latin America/Spain | 284 |
United Kingdom | 285 |
France | 297 |
International | 500 |
Note that this value needs to correspond to the CCSID used on the host.