Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 12: DBRM, Package, Plan and DB2 JCL


Plan

A plan is the executable control structure DB2 loads when your program runs. Every DB2 program executes under a plan.

What is a plan

  • A plan is created by BIND PLAN, either from DBRMs directly or from a list of packages (PKLIST).
  • It is stored in the DB2 directory and named in the JCL (or DSN RUN) that executes the program.
  • At run time DB2 loads the plan to find the access paths for the program's SQL.
  • One plan can serve many programs, and one program always runs under exactly one plan per execution.

Plans with packages vs plans without

  • Classic style: BIND PLAN with MEMBER and LIBRARY binds DBRMs straight into the plan. Any change means rebinding the whole plan.
  • Modern style: BIND PLAN with PKLIST(collection.*). The plan only points to packages, so you rebind just one package when one program changes.
  • Mixed style is allowed: a plan can list both packages and DBRMs together.
  • For any application with more than a few programs, the package style is easier to maintain.

The PKLIST parameter

  • PKLIST names collections and packages in search order, for example PKLIST(TESTCOLL.*, PRODCOLL.PAY01).
  • A trailing .* means all packages in that collection.
  • Order matters: DB2 uses the first match it finds, so put the preferred collection first.
  • PKLIST is a BIND PLAN parameter. It does not exist on BIND PACKAGE.

Example: BIND PLAN with PKLIST

  • The plan PAYPLAN points at every package in collection PAYROLLP. RETAIN keeps existing authorizations on replace:
    DSN SYSTEM(DB2A) BIND PLAN (PAYPLAN) PKLIST (PAYROLLP.*) ACTION (REPLACE) RETAIN ISOLATION (CS) END





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant