IKJEFT01 - Bind Db2 Program


IKJEFT01 utility is used to bind the SQL queries to the program for execution.

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 executing the module after binding it to package.

The syntax is the BIND JCL to bound the COBOL + DB2 program.


Syntax: -

//STEP01 EXEC PGM= IKJEFT01
//SYSPRINT DD  SYSOUT=*
//SYSTSPRT DD  SYSOUT=*
//SYSUDUMP DD  SYSOUT=*
//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’)
/*

PACKAGE:

Package contains optimized access path (OAP) generated by optimizer of BIND.

Package is non- executable component.

Package can contain one or more DBRMS.

Package is an intermediate component between the DBRM and PLAN.

The main advantage of the package is, rebind not required even any changes in sub program and compilation of subprogram is only sufficient.


PLAN:

Plan also contains optimized access path but is an executable component.

Plan will be used to execute the program.

Plan will have the best access path to retrieve the data from database based on the SQLs coded in the program.


VALIDATE:

Validate used to control the handling of DB2 objects.

The validate options are RUN, BIND.

If not specified anything, RUN is default. i.e VALIDATE(RUN).

Validate does not throw any error messages during the bind.

Validate throws warning messages at the time of Running.


MEMBER:

MEMBER is the DBRM name for the program stored in the DBRM library.


ISOLATION:

ISOLATION used to determine how much time the program can be isolate to the package from the effect of other programs execution.

In other words, how the program execution is isolated for accessing the database that 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 that determine the page lock duration.


Types of isolation levels -

CS ------ Cursor Stability.

RR ------ Repeatable Read.

UR ------ Uncommitted Read.

OR

DR ------ Dirty Read.


RELEASE:

RELEASE option is used to release the acquired lock on DB2 tables when the option specified.

The point of option specified can be the COMMIT point or the program terminates point.

For example, let us assume DB2 requires an exclusive lock to update particular table.

In this scenario, the exclusive lock taken by the program will be released whenever the options in RELEASE performed in the program execution.

If COMMIT is coded in RELEASE option, the Exclusive lock will not get released until or unless the COMMIT executed in the program.


LIB:

LIB is the library used to store the DBRMs.

LOAD module of COBOL+DB2 program.

It consists Object code of COBOL, Object code of DB2 and Runtime supervisor.


Runtime Supervisor:

Runtime supervisor is responsible to validate the time stamps of COBOL and DB2 object codes.

It checks the object code timestamp tokens of COBOL (T1) and DB2.

If T1=T2 ------ program is ready for execution.

If T1!=T2 ------ program is ABENDs with -818 (timestamp mismatch error).


Example: -


Below example to bind the program COBOLDB to plan DBPLAN using IKJEFT01 utility.


Job: -

***************************** Top of Data ******************************
//MTHUSRD  JOB (123),'MTHUSR',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),        
//             NOTIFY=&SYSUID                                           
//**********************************************************************
//*  DB2 BIND JCL                                                       
//**********************************************************************
//BIND     EXEC PGM=IKJEFT01                                            
//STEPLIB  DD  DSN=XXXXXX.DB2.SDSNEXIT,DISP=SHR                         
//         DD  DSN=XXXXXX.DB2.SDSNLOAD,DISP=SHR                         
//DBRMLIB  DD  DSN=MTHUSR.DBRMLIB,DISP=SHR                              
//SYSPRINT DD  SYSOUT=*                                                 
//SYSTSPRT DD  SYSOUT=*                                                 
//SYSUDUMP DD  SYSOUT=*                                                 
//SYSTSIN  DD  *                                                        
DSN SYSTEM (DB01   )                                                    
BIND  MEMBER    (COBOLDB ) -                                            
      PLAN      (DBPLAN  ) -                                            
      ACTION    (REP)      -                                            
      ISOLATION (CS)       -                                            
      VALIDATE  (BIND)     -                                            
      RELEASE   (COMMIT)   -                                            
      OWNER     (MTHUSR)   -                                            
      QUALIFIER (MTHUSR)                                                
END                                                                     
/*                                                                      
**************************** Bottom of Data ****************************

Explaining Solution: -

  • STEPLIB DD - Specifies DB2 load libraries required to bind the program.
  • DBRMLIB DD - Specifies the DBRMLIB where the program DBRM stored which required to bind.
  • SYSPRINT DD - specifies a sysout class where all product usage reports produced by IBM are written.
  • SYSTSPRT DD - Used to control the output from the background job.
  • SYSUDUMP - specifies the output class where the dump is placed in the event of an ABEND. A data set name may be used instead of a sysout class.
  • SYSTSIN DD * - Used to specify the data to follow which consists of executable commands and/or subcommands.

Note:

Change the STEPLIB libraries, DBRMLIB, SYSTEM, PLAN, ACTION, OWNER and QUALIFIER according to the system setup and change MEMBER name with the program that needs to bind.

Once the details updated, the above JCL can directly submit to bind the program.