× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Robert,

It's not quite as straightforward as it seems... When you run CREATE PROCEDURE to create an external UDF (i.e. one that calls an RPG or other HLL program) it does not actually create an object on disk. It just creates a definition inside the database of how to call your RPG program/srvpgm.

However, you do have the option to specify a library on the CREATE PROCEDURE statement. CREATE PROCEDURE MYLIB/MYPROC... If unspecified, it uses *CURLIB, like most all IBM-supplied create commands. The library you give here is also saved to the definition inside the database.

When you call a procedure, it can search *LIBL (or your SQL PATH, etc) but it does this by looking inside the special IBM supplied PF -- which is a little hard to understand at first, but basically instead of searching for an object on disk by library list, it searches the SQL Table looking for a matching procedure. For example if your library list is LIB1, LIB2, LIB3, then it looks in the PF for a procedure under LIB1 first, if not found it looks under LIB2, and if still not found, it looks under LIB3 -- so even though it's searching records in a file, it searches them as if searching a library list.

And the definition that it finds in that file is subsequently used to find/call your RPG routine. (This definition could potentially also use *LIBL, so you end up searching the library list twice -- but that is not recommended.)


On 8/2/2013 9:11 AM, Robert Mullis wrote:
I am trying to create my first UDF to use in embedded SQL in an RPGLE
program. I have created the procedure in a service program with no
problem, but I have a question about the UDF. When the UDF is created,
what library is it created in? Also, if the service program that the
UDF uses is moved to another library, what happens to the UDF? Does it
move to the new library with it?



Thanks,

Robert J. Mullis


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.