× 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'm having a problem updating a 8s0 field in an AS400 DB2 database using
RLA via the JTOpen Toolbox. I get a ClassCastException when the last two
lines of code execute.


 Below is a snippet of the code.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

               //Develop the file.
               // Create a record format instance for WLMLOGIN.
               RecordFormat[] fmtWFMLOGIN = (new
AS400FileRecordDescription(as400,
"/QSYS.LIB/GBTINET.LIB/WLMLOGINUP.FILE/%FILE%.MBR")).retrieveRecordFormat
();
               //Create a keyed file access instance for WLMLOGIN
               KeyedFile fileWLMLOGIN = new KeyedFile(as400,
"/QSYS.LIB/GBTINET.LIB/WLMLOGINUP.FILE/%FILE%.MBR");
               //Set the record format of file WLMLOGIN
               fileWLMLOGIN.setRecordFormat(fmtWFMLOGIN[0]);

               //Develop the key list.
               //Create an Object array that will represent the key list
for WLMLOGIN.
               Object[] keyWLMLOGIN = new Object[1];
               //Set the value of the keys
               keyWLMLOGIN[0] = UserName;

               //Open WLMLOGIN with a file access of Read and Write, One
record to retrieve, No commitment control to be used for the file.
               fileWLMLOGIN.open(AS400File.READ_WRITE, 1,
AS400File.COMMIT_LOCK_LEVEL_NONE);

               //Read the first record matching the key
               Record rcdWLMLOGIN = fileWLMLOGIN.read(keyWLMLOGIN);

               //If Record is not null then a match on the key was found.
               if (rcdWLMLOGIN != null)
               {
                    BigDecimal bdLstAccDate = new
BigDecimal(DateUtil.getCurrentDate(DateUtil.CCYYMMDD_FORMAT).toString());
                    BigDecimal bdLstAccTime =  new
BigDecimal(DateUtil.getCurrentTime(DateUtil.MILITARY_FORMAT).toString());

                    //Always update Last accessed date and time
                    rcdWLMLOGIN.setField("LSTACCDAT",(Object)
bdLstAccDate);
                    rcdWLMLOGIN.setField("LSTACCTIM", (Object)
bdLstAccTime);
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Here is the exception:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[5/12/03 14:19:59:986 NDT]  a618fb9 WebGroup      E SRVE0026E: [Servlet
Error]-[com.membersonly.servlet.LoginServlet]:
java.lang.ClassCastException: com.ibm.math.BigDecimal
     at
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:57)
     at
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:461)
     at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:414)
     at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:614)
     at
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:190)
     at
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:406)
     at
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:57)
     at
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:461)
     at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:414)
     at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:614)
     at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:414)
     at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:614)
     at
com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:43)
     at
com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:41)
     at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:941)
     at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:614)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Any help would be great. Thanks


Mark Evans
Programmer, Corporate Systems
Johnson Inc
Email....: mevans@xxxxxxxxxx


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.