296 DB2 UDB for z/OS: Application Design for High Performance and Availability
SET CURRENT PACKAGE PATH
Note that in the scenario above, we issued the SET CURRENT PACKAGE SET statement
multiple times, and each time, since this is a distributed application, we make a trip across the
network to the DB2 server to find a matching package. If you need to search many
collections, this can be an expensive operation. In addition, you need to have extra coding in
the application to handle the SQLCODE -805 and set the special register again and retry.
You can also use the SET CURRENT PACKAGE PATH special register to pass a list of
collections in which the server can search for a matching package. So, instead of potentially
issuing three SET CURRENT PACKAGE SET statements, you can also issue:
SET CURRENT PACKAGE PATH = ‘UNITTEST,SYSTEST,PROD’;
and invoke the SQL statement. This will potentially save two trips over the network.
We recommend the use of SET CURRENT PACKAGE PATH over the use of SET CURRENT
PACKAGE SET, because it can save network overhead and allows for more flexibility.
11.2 Thread reuse
For simple transactions, the CPU cost of creating a thread is an important part of the total
cost of the transaction. When these transactions are used frequently, an effort can be made to
minimize the thread creation cost. DB2 can reuse an existing thread, by performing just the
sign-on, and skipping the create thread.
Each time a transaction reuses a thread, the cost of creating a thread is avoided. So the
design objective should be to achieve as much thread reuse as possible without distorting the
application structure and the operational procedures for the BIND process.
Thread reuse is often used together with the RELEASE(DEALLOCATE) BIND option. See
“RELEASE” on page 291 for details. However, you do not have to always use both.