Since versioning of packages was introduced in DB2 there has been an ongoing debate of pro's and con's of this feature. The advantage is undoubtfully that you can introduce new versions of a package without any downtime at all. The problem is that you must remember to clean up old versions, otherwise you risk to have old versions of programs running, where they without versioning would have failed with timestamp error (SQL-code -805).
Clean up of old versions can be hard to acheive so some kind of solution in between will be really good. The following idea I got from Bonnie Baker, one of the famous DB2 guru's. Instead of versioning you can use two collections, the current collection and a fallback collection. When fallback no longer is required you simply remove the obsolete packages by FREE'ing them from the fallback collection.
The concept is implemented in the following three steps:
It is essential to use VALIDATE(RUN) because most of the time packages in the FALLBACK collection will be unavailable.
Here you must be careful with the order of the BIND operations. The smart part is the COPY operation that copies the current package to the FALLBACK collection. After the execution of these two BIND operations, MYPLAN is able to execute both the old and the new version of program MYPACK.
If you already are using generic packages (MYCOLL.*) it is very simple to implement this versioning concept, while it is a more time consuming effort if you still want to explicitly name all packages in the package list. With explicit naming you have to repeat every package in the fallback collection. You may use a generic specification for the fallback collection together with explicit naming in the current package list. Then you must remember to put the fallback collection last in the package list in order to acheive the best performance results.