Module 12: DBRM, Package, Plan and DB2 JCL
BIND PLAN
BIND PLAN creates the executable plan DB2 loads at run time. You bind a plan once per application, then maintain it through packages.
What BIND PLAN does
- It creates the plan: the control structure DB2 uses to locate access paths at execution time.
- It can bind DBRMs directly with MEMBER and LIBRARY, or simply reference packages with PKLIST.
- Like BIND PACKAGE, it checks syntax, objects and authorization, and runs the optimizer.
- The plan is stored in the DB2 directory and is named on the DSN RUN step that executes the program.
When to use BIND PLAN
- Bind the plan once when the application is set up.
- Rebind it when its PKLIST changes: new collections, new packages, or a version promotion.
- Day-to-day program changes go through BIND PACKAGE or REBIND PACKAGE. The plan usually stays untouched.
Key BIND PLAN options
- PKLIST - collections and packages in search order, for example PKLIST(MYCOLL.*). Only valid on BIND PLAN.
- MEMBER and LIBRARY - bind DBRMs directly into the plan instead of using packages.
- ACTION(ADD | REPLACE) and RETAIN - RETAIN keeps existing EXECUTE authorizations when you replace a plan.
- VALIDATE(BIND | RUN) - when object existence and authorization are checked.
- ISOLATION(CS | RR | UR | RS) - locking behavior for programs bound directly into the plan.
- ACQUIRE(USE | ALLOCATE) and RELEASE(COMMIT | DEALLOCATE) - when locks and resources are acquired and released.
- EXPLAIN(YES | NO) - capture the optimizer's access paths in PLAN_TABLE.
Example: full BIND PLAN job
- A complete batch job that binds DBRM member EMPDBRM directly into plan EMPPLAN:
//BINDPLAN JOB (ACCT),'BIND PLAN',CLASS=A,MSGCLASS=X //BIND EXEC PGM=IKJEFT01 //SYSTSPRT DD SYSOUT=* //SYSTSIN DD * DSN SYSTEM(DB2A) BIND PLAN (EMPPLAN) MEMBER (EMPDBRM) LIB ('USERID.DBRMLIB') VALIDATE (BIND) ISOLATION (CS) RELEASE (COMMIT) ACTION (REPLACE) RETAIN OWNER (APPOWN) END /*
