Release exclusive control.
UNLOCK >>-UNLOCK--FILE(filename)--+------------------+-----------------> '-TOKEN(data-area)-' >--+-------------------+--------------------------------------->< '-SYSID(systemname)-'
Conditions: DISABLED, FILENOTFOUND, ILLOGIC, INVREQ, IOERR, ISCINVREQ, NOTAUTH, NOTOPEN, SYSIDERR
UNLOCK releases the exclusive control established in response to a read command with the UPDATE option. You use it if you retrieve a record for update, and then decide that you do not want to update the record after all. However, for a recoverable file (other than one that refers to a coupling facility data table), the resource remains locked until either a SYNCPOINT command is executed or the task is terminated. The record can be in a data set, or in a CICS® or user-maintained data table, on a local or a remote system.
If the UNLOCK command refers to a record in a recoverable coupling facility data table the record lock is released immediately provided that the task has not made any previous change to the same record (or added it as a new record) within the current unit of work. If changes have been made to the record, or it is a new record added to the table, it remains locked until either a SYNCPOINT command is executed or the task is terminated.
If an UNLOCK command does not have a token, an attempt is made to match it to either a read with the UPDATE option that also does not have a token, or to a WRITE MASSINSERT operation. If neither of these is found, no action is taken and a NORMAL response is returned.
Use this command to terminate a VSAM WRITE MASSINSERT operation against a VSAM file.
The UNLOCK command does not release locks held against records locked in response to READNEXT or READPREV commands that specify the update option. It only invalidates the TOKEN value so that it cannot be used to complete an update.
If SYSID is specified, the data set to which this file refers is assumed to be on a remote system irrespective of whether the name is defined to CICS. Otherwise, the resource definition is used to find out whether the data set is on a local or a remote system.
If you specify UNLOCK with the TOKEN returned on a READNEXT UPDATE or READPREV UPDATE command for a file accessed in RLS mode, the UNLOCK command invalidates the TOKEN value so that it cannot be used to complete an update. It does not release the record lock.
TOKEN can be function shipped. However, if a request specifying TOKEN is function shipped to a CICS region that does not support this keyword, the request fails.
A file is disabled by an EXEC CICS SET FILE or a CEMT SET FILE command.
This condition cannot occur when the UNLOCK follows a successful read for update or a VSAM WRITE MASSINSERT.
Default action: terminate the task abnormally.
Default action: terminate the task abnormally.
See EIBRCODE in the EXEC interface block; for details, see EIB fields.
Default action: terminate the task abnormally.
Default action: terminate the task abnormally.
For VSAM files, IOERR usually indicates a hardware error. Further information is available in the EXEC interface block; for details, see EIB fields.
For a coupling facility data table, an IOERR indicates a bad response returned from a coupling facility access.
Default action: terminate the task abnormally.
Default action: terminate the task abnormally.
Default action: terminate the task abnormally.
This condition does not occur if the request is made to a CLOSED, DISABLED file. In this case, the DISABLED condition occurs.
It also cannot occur when the UNLOCK follows a successful READ for update or a WRITE MASSINSERT operation.
Default action: terminate the task abnormally.
Default action: terminate the task abnormally.