× 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 trying to create a class to call a RPG program.  There is only one 
parameter but it is a data structure made up of several numeric fields with two 
character fields at the end.  There are no errors in the source code but when I 
try to create a proxy and test it using the WAS Express server in WDSc the 
server doesn't load the class.  Looking at the console I see the message 
"SRVE0020E: [Servlet Error]-[com_payoffcalculatorpkg_GetPayoff]: Failed to load 
servlet: java.lang.ClassCastException: com.payoffcalculatorpkg.GetPayoff".  
From what I can find on the web I'm trying to cast a variable in a way that 
isn't allowed.  I've been working on this since yesterday and I just don't see 
it.  The code is listed below.

Can anyone point me in the right direction?

package com.payoffcalculatorpkg;

import com.ibm.as400.access.*;

/**
 * @author rcheva1
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
public class GetPayoffServer {

        // Communication constants
        private static final String system = "AS400DEV";
        private static final String userid = "RCHEVA1";
        private static final String password = "WIN2K12";
        private static final String library = "CBSUSER";
        private static final String program = "LN0716";

        // Communication objects
        private AS400 as400;
        private ProgramCall call;
        private ProgramParameter[] parms;

        // Server data structure
        private AS400Structure data;

        public GetPayoffServer() {
                super();
                init();
        }

        private void init()
        {
                as400 = new AS400(system, userid, password);    // iSeries 
connection
                parms = new ProgramParameter[]  // Array of parameter objects
                {
                        new ProgramParameter(105)       // Parameter array 
element
                };
                String ifspath = QSYSObjectPathName.toPath(library, program, 
"PGM");
                call = new ProgramCall(as400, ifspath, parms);  // Program call 
object
                data = new AS400Structure        
                (
                        new AS400DataType[]     
                        {
                                new AS400ZonedDecimal(12, 0),
                                new AS400ZonedDecimal(6, 0),
                                new AS400ZonedDecimal(11, 2),
                                new AS400ZonedDecimal(11, 2),
                                new AS400ZonedDecimal(9, 2),
                                new AS400ZonedDecimal(7, 2),
                                new AS400ZonedDecimal(7, 2),
                                new AS400ZonedDecimal(9, 2),
                                new AS400ZonedDecimal(9, 2),
                                new AS400ZonedDecimal(11, 6),
                                new AS400ZonedDecimal(9, 2),
                                new AS400Text(1, as400),
                                new AS400Text(3, as400)
                        }
                );              // Data structure object
        }       // init()

        // Call the program by running the CALL command
        public Object[] run(Object[] input)
                throws Exception
        {
                try
                {
                        parms[0].setInputData(data.toBytes(input[0]));
                        call.run();
                        return (Object[]) 
data.toObject(parms[0].getOutputData());
                } catch(Exception e)
                        {
                        System.out.println("Error: " + e.getMessage());
                        throw new Exception(e.getMessage());
                        }
        }

        public void shutdown()
        {
                as400.disconnectAllServices();
        }
}


Rick Chevalier
 <<ole0.bmp>>
Enterprise Solutions
Ext. 57178



Privileged and Confidential.  This e-mail, and any attachments there to, is 
intended only for use by the addressee(s) named herein and may contain legally 
privileged or confidential information.  If you have received this e-mail in 
error, please notify me immediately by a return e-mail and delete this e-mail.  
You are hereby notified that any dissemination, distribution or copying of this 
e-mail and/or any attachments thereto, is strictly prohibited.

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.