Plans, Packages, and BIND
Understand how embedded SQL becomes an executable access path through the precompile-BIND process, and what plans and packages actually are.
Embedded SQL doesn't run directly the way interpreted SQL might — it goes through a distinct precompile-and-BIND process that produces the actual executable access path DB2 uses at runtime, and understanding this pipeline is essential to explaining how a COBOL-DB2 program actually gets from source code to production execution. This is one of the more commonly misunderstood DB2 topics, and interviewers use it to separate developers who've only written SQL from those who've actually built and deployed DB2 programs.
Precompile-and-BIND is like a restaurant pre-planning the exact prep steps for a dish based on today's specific inventory — the recipe (SQL) doesn't change, but the kitchen's step-by-step execution plan (access path) gets refreshed whenever the pantry's stock (statistics) meaningfully changes, which is why a periodic REBIND after restocking (RUNSTATS) can produce a noticeably faster dish.