Locks for UPDATE
Specifying UPDATE on a READNEXT or READPREV command acquires an exclusive lock. The duration of these exclusive locks within a browse depends on the action your application program takes and on whether the file is recoverable or not.
- If the file is recoverable and you decide to DELETE or REWRITE the last record acquired by a read for update in a browse (using the associated token), the VSAM exclusive lock remains active until completion of the UOW. That is, until successful sync point or rollback.
- If the file is not recoverable and you decide to DELETE or REWRITE the last record acquired, the lock is released either when you next issue an ENDBR command or when you issue a subsequent READNEXT or READPREV command. This is explained more fully in RLS Record level locking.
- If you decide not to update the last record read, CICS frees the exclusive lock either when your program issues another READNEXT or READPREV command in the browse, or ends the browse.
Note:
An UNLOCK command does
not
free an RLS exclusive lock
held by VSAM against a record acquired during a browse operation.
An UNLOCK within a browse invalidates the TOKEN returned by the
last request. Another READNEXT or READPREV in the browse also invalidates
the TOKEN for the record read by the previous READNEXT or READPREV
UPDATE command. Therefore, it is not necessary to use UNLOCK in an
application program that decides not to update a particular record.