Making a user-defined function reentrant
A reentrant user-defined function is a function for which a single copy of the function can be used concurrently by two or more processes.
About this task
- The operating system does not need to load the user-defined function into storage every time the user-defined function is called.
- Multiple tasks in a WLM-established stored procedures address space can share a single copy of the user-defined function. This decreases the amount of virtual storage that is needed for code in the address space.
When the primary program of a user-defined function calls another program, DB2® uses the CURRENT PACKAGE PATH special register to determine the list of collections to search for the called program's package. The primary program can change this collection ID by executing the statement SET CURRENT PACKAGE PATH.
If the value of CURRENT PACKAGE PATH is blank or an empty string, DB2 uses the CURRENT PACKAGESET special register to determine the collection to search for the called program's package. The primary program can change this value by executing the statement SET CURRENT PACKAGESET.
If both special registers CURRENT PACKAGE PATH and CURRENT PACKAGESET contain a blank value, DB2 uses the method described in Binding an application plan to search for the package.