Application Plans and Packages

Question: What is the difference between a package and an application plan? If it is the same then what is the benefit of using packages?

Answer: Both Application Plans and Packages perform the same function with respect to db2 programs. They provide the connectivity between your program and the db2 database. The difference is that an Application Plan provides the connectivity for a complete program (including all of the called sub-programs) while a package can provide the connectivity for a single sub-program. Each program must have an application plan but packages are an optional component that makes maintaining the application plans much easier.

In order for your program to be able to be executed without giving a -818 SQLCODE you need to bind an application plan for your entire program. If you are just using application plans then you will need to rebind the entire application plan for your program whenever the program or any of its sub-programs is changed. This can be time consuming and does not provide a backup if the bind fails. If instead you build a package for each program and sub-program and just provide pointers to these packages in the final application plan for each program then recompiling a sub-program requires only that its corresponding package be rebound and not the application plans for all of the programs that reference that sub-program. This not only saves considerable execution time while the bind is running but also your online programs will be offline for a shorter time while a package is being rebound than they would be if you rebind the application plan. Also you only need to rebind the package corresponding to the one sub-program so only the sub-program corresponding to that package would be affected and not the entire transaction.


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow