The cp_dbmsDescr info describes the table data. The cp_fileDescr info describes what you put into the COPY statement as the contents of the data file. What the program has to do is convert the data from cp_fileDescr type to cp_dbmsDescr type.
cp_fileDescr.fd_prec has the precision in the high byte and the scale in the low byte, i.e. it's (prec*256)+scale. In the IIAPI_DESCRIPTOR (cp_dbmsDescr), the precision and scale are broken out separately for you.
The copy map includes all the file datatype info so that a generic copy front-end can be written. If your program knows the incoming data formats, you can ignore the cp_fileDescr part of the copy map, but it's still up to your program to convert the data into table row format (cp_dbmsDescr) in the proper column order. It sounds like you need to rescale the incoming decimal values to match whatever is in the table (decimal(18,17) apparently), and you'll need to deal with overflow somehow.
|