|
(I am appending again. Sorry if this shows up twice)
Joe is correct, the difference is in the level of the Toolbox.
Toolbox mod 0 and mod 1 -- if the parameter list is null the class
creates a empty array and keeps going. This is what you see on the
client.
Toolbox mod 2 and greater -- if the parameter list is null an exception
is thrown. This is what you see on the AS/400.
You must be runing mod 0 or 1 on the client and mod 2 or later on the
AS/400. This is not a difference between JVMs, it is a difference in
the level of the toolbox.
I think the mod 2 behavior is correct. A parameter list is a required part
of calling a program. Mod 0/1 assumes if the program passes null it really
means an empty array (no parameters). Assuming is a dangerous thing, that
is why I think it is better to throw then exception and make the program
pass an empty array if there are no parameters. This behavior is also more
consistent with the rest of the Toolbox which throws exceptions if key
parameters are null. I hate changing behavior from one release to the
next, but in this case I think it is a good change.
David Wall
AS/400 Toolbox for Java
"Bruce Jin" <brucej@MRC-PRODUCTIVITY.COM>@midrange.com on 01/17/2001
03:36:15 PM
Please respond to JAVA400-L@midrange.com
Sent by: owner-java400-l@midrange.com
To: <JAVA400-L@midrange.com>
cc:
Subject: Call RPG from Java using ToolBox - run on PC and fail on AS400
Hello:
I wrote a simple java program to call a simple RPG program. The RPG program
is called TEST1 and it has no *ENTRY PLIST in it. The code is listed
below.
The java class runs OK on PC (it prompts system, name user, password). The
RPG is called correctly. The output on the VAJ console is like this:
AS400 obj created...
pgm.run() = true
Call completed.
When I copied this class to AS400 and run it in Qshell, the class ran but
the call failed and I get the following output:
> java CallRPG2
AS400 obj created...
error=java.lang.NullPointerException: parameterList
Call completed.
$
Any ideas?
TIA. Bruce
import com.ibm.as400.access.*;
class CallRPG2 {
public static void main(java.lang.String[] args) {
boolean pgmrun;
AS400 as400 = new AS400();
System.out.println("AS400 obj created..." );
ProgramCall pgm = new ProgramCall(as400);
try{
pgm.setProgram(QSYSObjectPathName.toPath("BRUCELIB", "TEST1",
"PGM"),null);
pgmrun = pgm.run();
System.out.println("pgm.run() = " + pgmrun);
if (pgmrun != true) {
AS400Message[] msgList = pgm.getMessageList();
for (int i=0; i<msgList.length; i++)
System.out.println(msgList[i].getText());
}
} catch (Exception e) {
System.out.println("error=" + e);
}
System.out.println("Call completed." );
as400.disconnectService(AS400.COMMAND);
System.exit(0);
}
}
+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---
+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.