Implementation of a table level locks in a COBOL-DB2 program during program execution

DB2DatabaseBig Data Analytics

The COBOL-DB2 program can place the lock into a DB2 table in two ways.

  • When the SQL statement using that table is executed within the program.

  • When the program is loaded in the main memory and it is ready to be executed. It acquires a lock on all the DB2 tables which are used in the SQL statements within the program.

To acquire the lock on all DB2 tables once the program is loaded in the main memory or allocated to a thread, we have to BIND the plan using appropriate options and parameters. Below is a JCL step which can be used.

//BIND EXEC PGM=IKJEFT01
//STEPLIB DD DSN=DIS.TEST.LOADLIB,DISP=SHR
//SYSOUT DD SYSOUT=*
//SYSTSIN DD *
DSN SYSTEM(TB3)
BIND PLAN(PLANA) -
PKLIST(PACKA) -
ACQUIRE(ALLOCATE)
/*

The BIND option ACQUIRE will be used for this purpose along with the ALLOCATE parameter.

raja
Published on 11-Sep-2020 12:34:54
Advertisements