I am trying to create an SQL function that effectively calls an RPG program and returns the result. I've read you can do it by creating a service program and calling it but I'm trying to do it without the service program.
I have successfully created an sql stored procedure that calls the RPG program and I've created a function that calls the stored procedure.
When i try to use the function, I get an error saying "FUN0001 not found".
I can successfully call the function directly using "CALL APPSTRPROC.FUNC0001(12345, 0)".
I've beat my head against the wall on this one. Any ideas?
Code that creates procedure and function
// Stored procedure to call rpg
Exec sql
Create or replace Procedure Appstrproc.FUNC0001(
in SystemSku dec(15),
out Retail dec(9,2))
Language RPGLE
Called on null input
Not deterministic
No external action
Reads sql data
External name FUNC00001A
Parameter style general;
// Function to call stored procedure
Exec Sql
Create or Replace Function Appstrproc.f_SkuGetCurrentRetail(SystemSku dec(15))
Returns Decimal(9,2)
Language SQL
Return Appstrproc.FUNC0001(SystemSku, 0);
Thanks,
Eric
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2026 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.