|
... or you register the RPG program as stored procedure and then write a
SQL UDF (without any C implementation). Within the function you call the
Stored Procedure and return the output parameter value.
It does not matter on whether you write a RPG function that calls the
program and returns the output parameter and then register the function as
UDF or whether you register the program as stored procedure and create an
UDF that calls the stored procedure.
As for including C-Code: SQL is converted into C-code with embedded SQL
and then compiled (with the C-Compiler). So when calling a stored procedure
the C-Code for calling the RPG program is generated under the covers.
BTW it is possible to directly call a (RPG) program in an SQL environment.
But the passed parameters must exactly match. Because SQL is translated is
translated into C for character parameters only pointers are passed.
That's why it is far better to register the (RPG) programs as stored
procedures.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
Modernization – Education – Consulting on IBM i
Database and Software Architect
IBM Champion since 2020
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
"Train people well enough so they can leave, treat them well enough so
they don't want to. " (Richard Branson)
"Learning is experience … everything else is only information!" (Albert
Einstein)
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.