To define an XDD file requires defining the data type of each column of the original data file. The following table describes the accepted XDD data types:
Type to be used in the XDD field specification |
Type description |
---|---|
BT_Numeric |
ASCII string representing a signed number with trailing sign, A convention (NUMERIC) |
BT_NumSA |
ASCII string representing a signed number with trailing sign, M convention (NUMERICSA) |
BT_NumSTS |
ASCII string representing a signed number with trailing separate sign (NUMERICSTS) |
BT_NumSLS |
ASCII string representing a signed number with leading separate sign (NUMERICSLS) |
BT_NumSLB |
ASCII string representing a signed number with leading separate sign, B convention (NUMERICSTB) |
BT_NumSTB |
ASCII string representing a signed number with trailing separate sign, B convention (NUMERICSLB) |
BT_Char |
Fixed-length ASCII string (CHAR) |
BT_Float |
Float or Double values (FLOAT) |
BT_Decimal |
Packed string representing a signed number in A convention. (DECIMAL) |
BT_Money |
Packed string representing a signed number in A convention (MONEY) |
BT_AutoIncrement |
Integer number represented in native O/S binary signed format (AUTOINCREMENT) |
BT_Bit |
1 or more bits (in case of sequences of BT_BIT) in 1-byte. We do not support having sequences of two or more BT_BIT fields. |
BT_Currency |
8-byte signed quantity, sorted and stored in Intel binary integer format (CURRENCY) |
BT_BinaryBuffer |
Binary buffer (CHAR) |
BT_Date |
4-byte value, day in the first byte, the month in the second byte, and the year in a two-byte word following the month. The year is expected to be set to the integer representation of the entire year (DATE) |
BT_Integer |
Integer number represented in native O/S binary signed format (INTEGER) |
BT_UnsignedBinary |
Integer number represented in native O/S binary unsigned format (UNSIGNED BINARY) |
BT_Time |
4- byte value. Hundredths of a second, second, minute, and hour values are each stored in 1-byte binary format (TIME) |
BT_LString |
Regular STRING type, except that the first byte of the string contains the binary representation of the string's length (LSTRING) |
BT_ZString |
A C string with the same characteristics as a regular string type except that it is terminated by a binary 0 (ZSTRING) |
See also <schema> table element.
Variable length fields map into SQL LONGVAR* fields.
The XDD structure allows the following elements and attributes for variable length field support.
For an XDD field mapped into a LONG VARCHAR or LONG VARBINARY, the following conditions must be met:
size="0"
sizefield="X" where "X" is a valid field containing the number of bytes (we suggest this field to be hidden, but this is not mandatory)
dbtype="clob" or dbtype="blob"
If one (or more) of the above condition is not met, error CTDBRET_CALLBACK_11 ("Unsupported clob/blob definition") is returned.
The fact that the XDD initially does not contain any error handling information immediately exposes data conversion errors to a SQL user. This provides the way to begin troubleshooting data conversion errors and to identify the proper settings to specify in your XDD file.
Visually Check Data with FairCom DB SQL Explorer
FairCom DB SQL Explorer and FairCom DB Explorer include a button to simplify identifying "bad" records.
To check for bad records in FairCom DB SQL Explorer or FairCom DB Explorer:
Check using a SQL Query
You can use the procedures in this section to identify data-conversion errors and use that information to fine-tune your XDD files.
If a query fails, it is possible the failure is due to a problem with SQL data conversion. Troubleshooting this type of error is quite easy with the following steps:
SELECT * FROM <table>
If none of the queries fail, the original query failure is not due to a conversion problem.
SELECT * FROM <table> ctoption(badrec)
ctoption(badrec) is a FairCom DB extension to SQL indicating the query should return only records having conversion errors and expose values that do not properly convert as NULL.
CTSQLCBK.FCS Log
The ctoption(badrec) command generates a log file, ctsqlcbk.fcs, in the FairCom DB SQL Server directory that can be used to determine the exact conversion error and the data causing it. This file lists all the fields that caused a conversion error exposed in SQL along with the value of the data that could not be converted. Note that the log contains information for the fields that result in propagating the conversion error to SQL. It does not log conversion errors that result in a SQL value because they were already handled successfully following the settings in the XDD.
Each log entry is made of three lines:
Convert error XXXX on field[YYYY]
Where XXXX is the error code indicating the cause of the conversion error, YYYY is the field on which the conversion error occurred.
For example:
Convert error 4028 on field[FIELD1]
{ctdbStringFormatToDateTime} on 0000000000 failed
00000000
Convert error 4028 on field[FIELD2]
{ctdbStringFormatToDate} on 00000000 failed
3030303030303030
Convert error 4118 on field[FIELD3]
[NormalizeCobolStr] ascii value is not a digit
2020202020202020
Convert error 4118 on field[FIELD4]
[NormalizeCobolStr] ascii value is not a digit
2020202020202020