ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Calling RPG from java

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calling RPG from java

    Hi, all.

    I am trying to call rpg program from java. RPG program has no parameter. It's just a simple program to populate data in to database. I created procedure as follow:

    CREATE PROCEDURE GC/GCPRC001 LANGUAGE RPG NO SQL
    EXTERNAL NAME GC/GCPRC001R PARAMETER STYLE GENERAL

    Then in java:

    CallableStatement cs;
    cs = connection.prepareCall(rpgCall);

    When I run java program it pass the statement above, no errors.
    But it doesn't populate any data in the file. I have no way to check whether program is running or not in as400.

    Any idea, anyone?
    floppyredshoes.

  • #2
    Re: Calling RPG from java

    Are you issuing an execute after the prepare call?

    PHP Code:
    CallableStatment cs conn.prepareCall(sqlCall);
    System.out.println("Calling RPG Program");
    cs.execute();
    cs.close();
    cs=null;
    conn.close();
    conn=null
    Predictions are usually difficult, especially about the future. ~Yogi Berra

    Vertical Software Systems
    VSS.biz

    Comment


    • #3
      Re: Calling RPG from java

      Like this maybe?


      CallableStatement sqlCall = connection.prepareCall("call GC.GCPRC001");

      sqlCall.execute();

      That's essentially how I'm calling some back end RPG programs from a Struts/JSP front end. Of course I'm passing parms but it should work the same. And a trick I used for testing was to have my RPG programs write to a log file so I know if they were called correctly or not
      Goodbye

      Comment


      • #4
        Re: Calling RPG from java

        That works!!! Thanks everyone!!!

        Comment

        Working...
        X