Module 12: DBRM, Package, Plan and DB2 JCL
Package
A package is the executable form of one DBRM after it has been bound. It is the unit DB2 actually runs.
What is a package
- A package is created by BIND PACKAGE from a single DBRM.
- It stores the access paths chosen by the DB2 optimizer for that program's SQL statements.
- Packages are stored in the DB2 catalog (SYSIBM.SYSPACKAGE). They are not PDS members.
- Each package carries a consistency token that must match the program's load module at run time.
Why packages are used
- Bind each program's DBRM separately instead of rebinding one giant plan.
- When one program changes, rebind only its package. The other programs are untouched.
- The same package can be listed in the PKLIST of many different plans.
- Different versions of a program can live side by side in different collections (next page).
Package vs plan - quick comparison
- Package = the bound form of one program's SQL.
- Plan = the bound control structure that points to packages (or DBRMs).
- A program always runs under a plan. The plan finds the program's package at run time.
- Small shops often bind DBRMs straight into a plan. Larger shops use packages plus collections.
Example: BIND PACKAGE control cards
- These DSN subcommands bind the DBRM member PROG1 into collection MYCOLL:
DSN SYSTEM(DB2A) BIND PACKAGE (MYCOLL) MEMBER (PROG1) LIB ('USERID.DBRMLIB') QUALIFIER (APPOWN) ISOLATION (CS) EXPLAIN (NO) END
