|
This works like a charm. thank you!
________________________________
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> on behalf of Robert
Rogerson <rogersonra@xxxxxxxxx>
Sent: Monday, March 2, 2026 2:27 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: SQL UDF to call RPG without service program
Hi Reeve,
I may be missing something but why not just call the RPG from the
function? I'm not sure of the purpose of the procedure and if it's needed.
Here's an example of a function calling an RPG program.
CREATE FUNCTION MYLIB.GETUPCHARGEFUNC (
WHSENBR NUMERIC(3, 0) ,
ITEMNBR NUMERIC(6, 0) )
RETURNS NUMERIC(7, 2)
LANGUAGE RPGLE
SPECIFIC MYLIB.GETUPCHARGEFUNC
NOT DETERMINISTIC
MODIFIES SQL DATA
CALLED ON NULL INPUT
NOT FENCED
EXTERNAL NAME 'MYLIB/GETUPCHRGF'
PARAMETER STYLE SQL ;
To call
SELECT
ivwhid AS "Warehouse",
ivitm# AS "Item Number",
GETUPCHARGEFUNC(ivwhid, ivitm#) AS "Up Charge"
FROM invmasp
WHERE ivwhid = 90
AND ivitm# = 5
ORDER BY 1, 2;
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.