Our software vendor has several RPGLE programs that they use like an API. Here is the code I use to wrap one of their more useful ones. It basically make an SQL reference to the external program and tells SQL how the parameters work etc. This should get you started.
-- Procedure to Get Addresses JHA CIF 20/20 Style
create procedure wibrun.jhaddr(inout cifno char(7),
inout altadd dec(1, 0),
inout acctno dec(11, 0),
inout actype char(1),
inout malhld char(2),
inout req varchar(5),
inout line1 char(35),
inout line2 char(35),
inout line3 char(35),
inout line4 char(35),
inout line5 char(35),
inout line6 char(35),
inout err char(1),
inout zip dec(9, 0),
inout delp char(2))
external name jharun.cfnamb
reads sql data
parameter style general
Whidbey Island Bank
If a cluttered desk is the sign of a cluttered mind, what is the significance of a clean desk? - Laurence J. Peter
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Thorbjørn Ravn Andersen
Sent: Tuesday, August 26, 2008 7:04 AM
To: Java Programming on and around the iSeries / AS400
Subject: JDBC CallableStatement, plain Program Call, and output parameters...
We have a single point of entry for our legacy system - an OPM Cobol
program - which I have a functional ProgramCall approach working. (Five
arguments, where two of them contain return values and I need to have an
initial CHGLIBL call).
I am now looking at using pooled connections, and I have an
AS400ConnectionPool approach working (which saves 0.3 seconds in
average), but I would like to see how a JDBC Stored Procedure behaves as
these pooling mechanisms are highly tuned.
and I can invoke my program with "call
FOOBAR/myprog('1','2','3','4','5')" as it takes five arguments (if there
are less I get a MCH0801)
Unfortunately I need the output values, so I try with a
c.prepareCall("call FOOBAR/myprog(?,?,?,?,?)") which immediately fails
with "[SQL0204] MYPROG i FOOBAR af typen *N er ikke fundet," (complains
that the program of type *N has not been found).
I have looked around and it appears that for this to work an actual
stored procedure must be defined in the database, and not just the
program to call. The wording in rzahh.pdf is "The stored procedure
being called must already be stored in the database".
The question is then, does "the stored procedure" refer to an actual
stored procedure created with "CREATE PROCEDURE ... etc..." or can it
just shortcut to a program found in a library?
This mailing list archive is Copyright 1997-2020 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