× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I use toolbox to retrieve column information from AS400 files. The code is as follows:

DatabaseMetaData dbMeta = connection.getMetaData();
resultSet = dbMeta.getColumns(null, “mylib”, “myfile”, null);
while (resultSet.next()) {
int size = resultSet.getInt("COLUMN_SIZE") ;
}

This code works on many AS400 boxes. But it fails on one particular file on an AS400 (V5R1). See error message below. Looking into source code of AS400PackedDecimal class, I guess a ‘0’ is used as field length to initiate the class, causing the exception. But this file is a valid file. This file does have a number of packed fields. Note: when I move this file to another as400, the code will work with no problem.

TOOLBOX source code:

public AS400PackedDecimal(int numDigits, int numDecimalPositions) {

if (numDigits < 1 || numDigits > 63) {
throw new ExtendedIllegalArgumentException("numDigits (" + String.valueOf(numDigits) + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID);
}
if (numDecimalPositions < 0 || numDecimalPositions > numDigits) {
throw new ExtendedIllegalArgumentException("numDecimalPositions (" + String.valueOf(numDecimalPositions) + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID);
}



ERROR MESSAGE:

com.ibm.as400.access.ExtendedIllegalArgumentException: numDigits (0): The parameter value is out of the allowed range.
com.ibm.as400.access.AS400PackedDecimal.<init>(AS400PackedDecimal.java:46)
com.ibm.as400.access.SQLDecimal.<init>(SQLDecimal.java:58)
com.ibm.as400.access.SQLDataFactory.newData(SQLDataFactory.java:612)
com.ibm.as400.access.JDTypeInfoFieldMap.getValue(JDTypeInfoFieldMap.java:59)
com.ibm.as400.access.JDPrecisionFieldMap.getValue(JDPrecisionFieldMap.java:52)
com.ibm.as400.access.JDMappedRow.getSQLData(JDMappedRow.java:157)
com.ibm.as400.access.AS400JDBCResultSet.getValue(AS400JDBCResultSet.java:3479)
com.ibm.as400.access.AS400JDBCResultSet.getInt(AS400JDBCResultSet.java:2781)
com.ibm.as400.access.AS400JDBCResultSet.getInt(AS400JDBCResultSet.java:2808)
MRCPS.MRCWRKF.getColumns(MRCWRKF.java:284)



Thanks.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.