- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Behaviour of a COBOL-DB2 program when number of locks exceed the limit
Problem: How will the COBOL-DB2 program behave once the number of locks placed on the table space exceeds the defined limit?
Solution
The number of locks which an application can place on a DB2 resource such as page, table row, etc., is defined in DSNZPARM. Once the number of page and row level locks in any table exceeds the permissible limit, then the lock escalation takes place.
In lock escalation, DB2 releases the page or row level lock which it has held and attempts to acquire a tablespace level or higher lock. In this case, the application now has wider access/scope to DB2 resources as the entire tablespace is locked for its processing.
For example, if we have below DB2 ORDERS table.
ORDER_ID | ORDER_TOTAL | ORDER_DATE |
A22345 | 1867 | 22-10-2020 |
A62998 | 5634 | 11-11-2020 |
A56902 | 7615 | 14-10-2020 |
A56911 | 87960 | 30-10-2020 |
A56915 | 132 | 09-10-2020 |
A56918 | 80363 | 04-10-2020 |
If a COBOL-DB2 program is updating this table for the predicates ORDER_TOTAL > 1000 and ORDER_DATE > 15-10-2020. As a result of this the COBOL DB2 program has placed locks in multiple rows which exceeds the maximum limit defined in DSNZPARM, then the lock escalation will take place.
In this case, DB2 will release the locks held in the multiple rows and place a lock in the entire ORDERS table. Due to any reason if DB2 is not successful in acquiring table lock in ORDERS table, then a rollback takes place and DB2 restores all the changes made in the table.
- Related Articles
- Implementation of a table level locks in a COBOL-DB2 program during program execution
- Implementation of a table level locks in a COBOL-DB2 program during SQL execution
- Steps involved in compilation of a COBOL-DB2 program
- Implementation of restart logic in a COBOL-DB2 program
- Impact of database downtime on the COBOL-DB2 program
- How to precompile a COBOL-DB2 program?
- Purpose and usage of SAVEPOINT in COBOL-DB2 program
- How to execute a COBOL-DB2 program PROGA of plan PLANA?
- How will the COBOL-DB2 program behave when there is a mismatch between the host variable and number of columns in the SELECT statement?
- How NON-REPEATABLE READ & PHANTOMS impact functioning of a COBOL-DB2 program?
- How to store a NULL value in a particular column of a DB2 table using COBOL-DB2 program?
- How LOST UPDATE and DIRTY READ impact the processing of a COBOL-DB2 program?
- How can you revert all the DB2 table changes done in a COBOL-DB2 program?
- What is the purpose and usage of “WHERE CURRENT OF” clause in a COBOL-DB2 program?
- What is the purpose and usage of “FOR UPDATE OF” clause in a COBOL-DB2 program
