Why am I getting a “[SQL0802] Data conversion of data mapping error” exception?

南楼画角 提交于 2019-11-28 01:54:49

"4 O" means 0x40 which is the EBCDIC code for a space or blank character and is the default value placed into any new space in a record.

Legacy programs / operations can introduce the decimal data error. For example if the new file was created and filled using the CPYF command with the FMTOPT(*NOCHK) option.

The easiest way to fix it is to write an HLL program (RPG) to read the file and correct the records.

The only solution I could find was to write a script that checks for blank values in the column and then updates them to zero when they are found.

If the file has record format level checking turned off [ie. LVLCHK(*NO)] or is overridden to that, then an HLL program. (ex. RPG, COBOL, etc) that was not recompiled with the new record might write out records with invalid data in this column, especially if the new column is not at the end of the record.

Make sure that all programs that use native I/O to write or update records on this file are recompiled.

I was able to solve this error by force-casting the key columns to integer. I changed the join from this...

FROM DAILYV INNER JOIN BXV ON DAILYV.DAITEM=BXV.BXPACK

...to this...

FROM DAILYV INNER JOIN BXV ON CAST(DAILYV.DAITEM AS INT)=CAST(BXV.BXPACK AS INT)

...and I didn't have to make any corrections to the tables. This is a very old, very messy database with lots of junk in it. I've made many corrections, but it's a work in progress.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!