|
-- I have written a generic class that takes any iSeries Physical File in the QSYS hierarchy and converts it to a csv file in the IFS. I use the ResultSetMetaData to determine the data type for each column eg. CHAR, INTEGER, DECIMAL etc. Based on this, I use the appropriate ResultSet retrieval method eg. getBigDecimal for DECIMAL. If the row data is good then everything runs fine. -- However, problems occur when a decimal column contains non-numeric data. Given that the file could originate from any one of many 3rd parties, I have no control over the validity of the data. Also it is neither possible or desirable to run a data cleansing process up front - the conversion class must handle the bad data at column level. I've tried : BigDecimal bd = rs.getBigDecimal(j) //- rs is ResultSet and j column index. followed by catch SQLException. Case 1. DECIMAL length 4 scale 2. File Data = Hex D5E8D5 (YNY) Is caught by above and handled OK by setting to zero. Case 2. DECIMAL length 8 scale 2. File Data = Hex 4040404040 (Blank) No exception thrown. I am looking for a test for case 2 that can identify blank so I can set the result to zero. Any suggestions much appreciated. Keith --
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.