|
The parameters are defined to be in the following order:
- n parameters for the input parameters that are specified for the function.
- A parameter for the result of the function.
- n parameters for indicator variables for the input parameters.
- A parameter for the indicator variable for the result.
- A CHAR(5) output parameter for SQLSTATE. ...
- A VARCHAR(517) input parameter for the fully qualified function name.
- A VARCHAR(128) input parameter for the specific name.
- A VARCHAR(1000) output parameter for the message text.
Am 22.01.2026 um 17:23 schrieb Daniel Gross <daniel@xxxxxxxx>:
Yes - that shouldn't be a big problem.
You have to use
PARAMETER STYLE DB2SQL
in the function definition. AFAIK "SQL" does also work, but I always use "DB2SQL".
With this you will have a parameter the contains the return value for the function.
Still one of the best resources for UDFs and UDTFs is Scott's presentation:
https://www.scottklement.com/presentations/RPG%20User%20Defined%20Functions%20&%20Table%20Functions.pdf
Scott's example is with a *SRVPGM procedure, but it works the same with a *PGM - it differs only in the EXTERNAL NAME clause.
HTH
Daniel
Am 22.01.2026 um 17:09 schrieb Justin Taylor <jtaylor.0ab@xxxxxxxxx>:--
I'd wager this is a long shot, but it can't hurt to ask.
I have an RPGLE *PGM that has a parameter that's basically an output
parameter. Is there a way to create an SQL UDF that can use that *PGM
object and make that output parameter an actual return value?
*SRVPGM is off the table. Don't ask... :(
Thanks
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
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.