Using Exclusive Access to Prevent Contention

A DP4 program can acquire exclusive access to a database by specifying the EXCLUSIVE flag when db_open() is called. If other programs are using the database already the call to db_open() will fail. Assuming it succeeds however, no other programs will be able to open that database.

When a program has exclusive access to a database, (and to a lesser extent when a program happens to be the only program using a database), DP4 can bypass some of the checks that are normally necessary when db_update() is called. Therefore for batch programs that can be run when a system is not in use by nromal users, it is worth considering using exclusive access, as it may improve performance. Additionally a program with exclusive access to a database does not need to have any code for dealing with contention.