If you need to switch plans within a transaction

The plan that a transaction uses to access DB2 must contain or reference the DBRMs from all the application programs that could operate under that transaction ID. If the plan doesn't contain all the relevant DBMRs you might consider switching plans within a transaction.

If the design of your applications has changed, some of your older plans might not contain all the relevant DBRMs. In this case, the application design could require a switch to a different plan in the course of a transaction, if the transaction requires that a program not included in the current plan must be executed. This situation could also occur if the structure of the DB2 plans was imperfectly considered during the design of the application.

The best solution to this problem is to use packages. You can bind the DBRM from the missing program into a package, and add the package to a package list in the existing plan. The transaction can now access the missing program without needing to switch plans. There are two other possible solutions, which are discussed as follows: