Dynamic plan switching
Use dynamic plan switching (DPS) if you want to use more than one plan in a transaction.
Dynamic plan switching (DPS) allows you to use more than one plan in a transaction. However, as noted above, switching plans in a CICS transaction instance should be a rare occurrence. The dynamic plan exit was designed to select a plan dynamically at the start of the transaction (dynamic plan selection), not to change plans frequently within transactions.
To do dynamic plan switching, the thread must be released at syncpoint and reacquired, to drive the dynamic plan exit. The dynamic plan exit can then be used to select the plan for the program you need to execute. This enables the use of a different plan for different UOWs within a transaction.
If you have coded your own dynamic plan exit, check that the logic copes with subsequent invocations for the same task. Either the user application or the dynamic plan exit must be written to tolerate consequences of additional calls to the exit. If the dynamic plan exit would change the plan when not wanted, the user application can avoid this by ensuring the thread is not released at syncpoint. Preferably, if the thread is released, the dynamic plan exit must provide the proper plan for the new cases when it is called, that is, a DB2ENTRY with THREADLIMIT > 0.
- It is a terminal driven task, or a nonterminal driven task and NONTERMREL=YES is set in the DB2CONN
- No held cursors are open
- Any DB2 special registers modified have been set back the their initial state.
- DB2 special register CURRENT DEGREE has ever been modified by this transaction.