• 4 replies
  • Latest Post - ‏2013-03-22T20:23:57Z by scott_klement
535 Posts

Pinned topic Calling RPG programs from Java

‏2013-03-14T10:13:01Z |
Hi all,

We're in the proces of investigating what's the best way of calling RPG programs from Java.
I've read some stuff about *PCML, but I'm wondering if this, in 2013, still is the best way to do it.

Any suggestions?
Thanks in advance!

Updated on 2013-03-22T20:23:57Z at 2013-03-22T20:23:57Z by scott_klement
  • scott_klement
    271 Posts

    Re: Calling RPG programs from Java

    The best way to do something rarely has to do with what year it is. More often, it has to do with what you're trying to accomplish, and how different approaches might better help you with that goal.

    Please tell us a little bit about what you're trying to accomplish.
  • B.Hauser
    110 Posts

    Re: Calling RPG programs from Java

    The easiest way to call RPG programs from Java is to register the RPG program as (SQL) stored procedure and call it from your Java applicatin by using the CALL SQL Command.

  • SystemAdmin
    535 Posts

    Re: Calling RPG programs from Java

    Hi Scott and Birgitta,

    Thanks for both of our answers!

    We want to have some webservices on a WAS use functionality written in RPG programs.

    The reason I asked is because we had a consultant over here telling us to call RPG's from JAVA with PCML.
    I had my doubts because I was thinking about doing it the with a stored procedure, as Birgitta mentioned.

    Thanks again!
  • scott_klement
    271 Posts

    Re: Calling RPG programs from Java

    There are many ways to call RPG from Java. Here are a few off the top of my head:

    1) PCML and the ProgramCallDocument class
    2) Via SQL, Stored Procedure Interface
    3) Via SQL, UDF Interface
    4) as a Java Native Method
    5) Via a web service call
    6) Via various system APIs

    We do not know which one is best for your environment, because all we know is that you have Java calling RPG. We don't know anything else about your environment.

    Native methods will only work within the same box, and so they are not suitable if you want the Java and RPG to reside on separate boxes.

    SQL is maybe the easiest, but requires you to trust the Java code will full SQL access to the database, which may be opening up more of your system than you want -- or maybe not -- depending on your circumstance.

    PCML works nicely, but has limitations on how many parameters you can pass, and what the data types of teh parameters may be.

    Web services don't have many limitations, but probably have the most overhead.

    It's really hard to make a recommendation when you won't tell us how your application works, what it does, etc. I guess you need to evaluate all of the different possibilities and decide for yourself.