|
It could be the way the parameters are declared. You are defining the first two parameters as an input/output parameters since you pass in both a byte array and an int. The second parameter (the int) is the amount of output data returned in the parm. In your case you say 2 bytes are returned in the first parm and 3 bytes are returned in the second parm. Try skipping the second parameter and see if that helps. It would be pList[0] = new ProgramParameter(coNo); pList[1] = new ProgramParameter(cycleNo); pList[2] = new ProgramParameter(7); Also, ProgramParameter accepts only byte arrays. If you need to pass a number to your RPG program use one of the Toolbox converters to convert your number into a byte array. Converters are available for most AS/400 numeric types. For example, if you have a bin 4, use: AS400Bin4 bin4 = new AS400Bin4(); byte AS400Data = bin4.toBytes(myInt); David Wall AS/400 Toolbox for Java "Robert Upshall" <rupshall@psasoft To: <java400-l@midrange.com> .com> cc: Sent by: Subject: problems with ProgramCall java400-l-admin@m idrange.com 01/07/2002 09:26 PM Please respond to java400-l I'm not sure what I need to so to get this working. I'm trying to call an rpg program that takes 3 parms, the first 2 input the 3rd output. All 3 fields are numeric, the only way I could get it to work without compile errors was to pass all parms as strings. I just convert them in the rpg. When I call the rpg from a green screen passing the same parms it gives the correct output but when I call from the java app it returns an error code for the 3rd parm. I'm guess what I'm looking for would be how to define the java and/or for the following code? Here is the java code: byte coNo = getKeyCoNo.byteValue(); byte cycleNo = getKeyCycleNo().byteValue(); ProgramParameter[] pList = new ProgramParameter[3]; pList[0] = new ProgramParameter(coNo, 2); pList[1] = new ProgramParameter(cycleNo, 3); pList[2] = new ProgramParameter(7); ProgramCall pgm = new ProgramCall(system, "/QSYS.LIB/PSSTGUI.LIB/CE1099.PGM", pLis); . . . byte[] data = pList[2].getOutputData(); AS400Text textConverter = new AS400Text(data.length, getSystem()); bAcctNo = new BigDecimal((String) textConverter.toObject(data)).setScale(0); Here is the RPG: C *ENTRY PLIST C PARM ECO# 20 C PARM ECYC 30 C PARM EACC 7 C MOVE ECO# CO# C MOVE ECYC CYCLE# 30 I need some help, Robert Upshall Professional Software of Amarillo (806) 358-8928 rupshall@psasoft.com _______________________________________________ This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l or email: JAVA400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.
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.