DB2 BIND Process
IKJEFT01 utility is used to bind the particular SQL queries to the program to execute.
COBOL + DB2 program can’t able to execute without bound it.
If the module is batch module (COBOL + DB2), simply bound the module to package is sufficient to execute.
If the module is online module (COBOL + DB2 + CICS), RCT entries also require to execute the module after bound it to package.
The below is the BIND JCL to bound the DB2 + COBOL program.
//STEP01 EXEC PGM= IKJEFT01 //SYSTSIN DD * DSN BIND PLAN(plan-name) VALIDATE(validate-opt) -> BIND, RUN MEMBER(DBRM-member-name) ISOLATION(isolation level) -> CS,RR,UR RELEASE(release-options) -> COMMIT, DEALLOCATE LIB(‘DBRM LIBRARY’) /*
Let’s discuss one by one in detail
Package contains optimized access path (OAP) which is generated by optimizer of BIND which is non- executable component.
Package can contains one or more DBRMS.
Package is an intermediate component between the DBRM and PLAN.
The main advantage of the package is, rebind is not required when any change in sub program. Compilation of subprogram is only sufficient.
Plan contains also optimized access path, which is executable component.
Plan will be used to execute the program.
Plan will have the best access path to retrieve the data from database by using the SQLs coded in the program.
Validate used to control the handling of objects.
The validate options are RUN, BIND.
If not specified anything it will take RUN as default. i.e VALIDATE(RUN).
Validate will not through any error messages during the bind and it will through warning messages at the time of Running.
MEMBER is nothing but the DBRM name for the program stored in the DBRM library
ISOLATION will used to determine how much time the program bound to the package can be isolated from the effect of other programs execution.
In other words, how the program execution is isolated for accessing the database which is accessed by the other programs concurrently.
Database can be accessed by the multiple users at a time (Concurrency). The Isolation level is the way to maintain the concurrency for the multiple users by setting the levels of access to the database.
ISOLATION is the BIND parameter which will determine the page lock duration.
Types of isolation levels:
CS ------ Cursor Stability. RR ------ Repeatable Read. UR ------ Uncommitted Read. OR DR ------ Dirty Read.
Isolation level can be explained in detail here
RELEASE option is used to release the acquired lock on DB2 tables whenever the release option specified was performed.
For example, DB2 requires an exclusive lock to update particular table. The Exclusive lock taken by the program will be released whenever the options in RELEASE performed.
If COMMIT is coded in RELEASE, Until or unless the COMMIT executed, the Exclusive lock will not get released.
LIB is nothing but the library used to store the DBRMs.
LOAD module of COBOL+DB2 program: it consists of
. Object code of COBOL. . Object code of DB2. . Runtime supervisor.
Runtime supervisor is responsible to validate the time stamps of COBOL and DB2 object codes.
It checks the timestamp tokens of object code of COBOL (T1) & object code of DB2.
If T1=T2 ------ program is ready for execution.
If T1=T2 ------ program is ABENDs with -818 (timestamp mismatch error).
If any questions on the above, post your queries on DB2 Discussion forum
DB2 Precompilation Process DB2 Isolation Levels