Problem solve Get help with specific problems with your technologies, process and projects.

SQL external UDFs

Can we have parameters for the external UDF be "pass by value" rather than reference?
I am not sure about this -- I do not use SQL much. But the manual "DB2 for AS/400 SQL Programming", chapter 14.4.1, 'Declaring Host Variables' (I am looking at V4R2) says that the ILE RPG/400 SQL pre-processor recognizes a limited set of RPG data types -- basically, any type that can be the result field of a PARM statement. This implies that if you write your UDF in RPG, you can use the factor1 / factor2 / result method of parameterization, where data passed by reference in the RESULT field is converted to a value in the field specified in factor1; and a value in factor2 is passed back as a value into the space pointed to by the result field pointer. It's worth experimenting with this.

If you don't use RPG for your UDFs, the other languages may also support some method of converting a reference to a value -- check their manuals. As for native SQL UDFs, I do not know how they pass parameters, so I can't comment.


The Best Web Links: tips, tutorials and more.

Visit the ITKnowledge Exchange and get answers to your developing questions fast.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

Dig Deeper on iSeries COBOL programming

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.