× 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.


  • Subject: Call RPG from Java using ToolBox - run on PC and fail on AS400
  • From: "Bruce Jin" <brucej@xxxxxxxxxxxxxxxxxxxx>
  • Date: Wed, 17 Jan 2001 15:36:15 -0600

 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
+---

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.