How NON-REPEATABLE READ & PHANTOMS impact functioning of a COBOL-DB2 program?

DB2DatabaseBig Data AnalyticsCOBOL

The NON-REPEATABLE READ conditions occur when the COBOL-DB2 program executes the same query multiple times, but the result of the query is different each time. This generally happens when two COBOL-DB2 programs access the same row of the DB2 table.

The first program reads the row, then the second program reads the same row, updates it and commits the changes. The first program again reads the same row but now the data does not match with the previous fetch.

The PHANTOM condition occurs when the number of rows in the query result does not match when the query is executed multiple times.

For example, if PROG A executes the query with certain WHERE conditions and gets 3 rows in the result. Now PROG B inserts a new row in the same table and the new row falls under the query predicate used by PROG A.

Finally, PROG A executes the same query and gets a total 4 rows in result. The extra 1 row is known as phantom.

Published on 30-Nov-2020 09:12:15