DB2 Universal Databaseā¢ for iSeriesā¢ has built-in integrity for records. For example, if PGMA reads a record for update operation, it locks that record. Another program cannot read the same record for update operation until PGMA releases the record, but another program can read the record just for inquiry.
In this way, the system ensures the integrity of the database. However, you can set your own wait time for a locked record to be released using the WAITRCD parameter.
The system determines the lock condition based on the type of file processing specified in your program and the operation requested. For example, if your open options include update or delete, each record read is locked so that any number of users can read the record at the same time, but only one user can update the record.
The system normally waits a specific number of seconds for a locked record to be released before it sends your program a message that it cannot get the record you are requesting. The default record wait time is 60 seconds; however, you can set your own wait time through the WAITRCD parameter on the create and change file commands and the override database file command. If your program is notified that the record it wants is locked by another operation, you can have your program take the appropriate action (for example, you can send a message to the operator that the requested record is currently unavailable).
If the record lock is being implicitly acquired as a result of a referential integrity CASCADE DELETE, SET NULL, or SET DEFAULT delete rule, the lock wait time is limited to 30 seconds.
You can display locked records using either the Display Record Locks (DSPRCDLCK) command or iSeries Navigator.