DB2 Session06
DB2 Session06
Pre-compilation
Compilation
Linking
Binding
Execution
© Strictly confidential 2
Pre-compilation
Involves the following sequence of events.
© Strictly confidential 3
Binding
Is the process of generating an application plan/package from a
DBRM.
Involves the following sequence of events.
◦ Checking syntax of SQL statements.
◦ Verification of authority on DB2 objects.
◦ Optimization of SQL statements to create an application plan.
© Strictly confidential 4
Application plan and package
Package
Is the executable form of a single DBRM, but is not independently
executable.
Is bound to an application plan with related packages.
Only the plan is independently executable.
If any DBRM is altered, then only the corresponding package needs
re-binding.
Plan
Is the executable form of one or more DBRMs and application
package.
Should be generated every time any DBRM is modified.
Are kept in the buffer pools during program execution.
© Strictly confidential 5
Relationship between DBRM, Package and Plan
PLAN
© Strictly confidential 6
Some Issues related to Binding
In CICS, every DBRM associated with a transaction
must be put under the same Plan.
The RCT (Resource Control Table) in CICS maintains TRANSID to
PLAN NAME relationship.
Good to use packages to avoid long bind time.
© Strictly confidential 7
Source Program
Program Preparation Summary
DBRM
Catalog Tables
Packages
Plans
Bufferpool
Pre-compile
Translate
Compile
Bind
© Strictly confidential 9
Some common SQL codes
0 Successful execution
+100 Row not found or end of records
-811 Multiple rows returned, but not coded
using cursor in application program
-803 Duplicate insertion for unique column
-818 Timestamp mismatch between DBRM and
load module
-911,-913 Deadlock or timeout
-904 Resource not available