Previous Topic: LOCK ParameterNext Topic: JCL Considerations


Usage

Local mode execution

If the LOCK AREA statement is issued through the batch command facility executing in local mode, a physical lock will be placed on the area. The lock remains in effect until an explicit UNLOCK is issued. If the area is already locked, the LOCK statement will fail with a DB002352 error message as illustrated in the sample output.

If the LOCK SEGMENT statement is issued in local mode, a physical lock will be placed on each area in the segment that is not already locked. A status of each area will be reported. Once all areas have been locked or checked, if any area in the segment was already locked, a DB002406 error message will be issued, as illustrated in the sample output.

Online execution

If the LOCK statement is issued through the online command facility (OCF) or through the batch command facility executing in a batch/CV mode, a logical lock will be placed on the area. This lock prevents all access to the area by other users until the session in which the LOCK statement is issued is committed. If executing online, a commit is automatically issued at end of task prior to the pseudo-converse unless autocommit is disabled through a SET OPTIONS statement.

The areas being locked must be varied in update mode to the central version. If another task is updating an area being locked, the LOCK command will wait until the logical area lock is available. If the wait would cause a deadlock, the LOCK command fails.

Committing prior work

Before executing this utility under a central version, you must commit any previous work done within the current session. For more information, see Central Version Considerations.