Record Locks

PURPOSE:  The RECORD LOCKS option controls whether access requests to a DS are queued or not.

SYNTAX

{ENABLE; DISABLE} RECORD LOCKS [IF; UNLESS clause]

ENABLE

sets up the Simple Queued environment for DS access.  When more than one user tries to access a DS, their requests are queued in the order they are received.  It allows for multi-user input and single user updating.  The queuing is done only on the record level (unlike the Concurrent Queued environment which queues at both the record and table levels).

DISABLE

returns DS accessing to the default environment.  This is the default state.

IF; UNLESS

specifies a condition for the option to be enabled or disabled.

Example

*ENABLE RECORD LOCKS
.
.
.
*DISABLE RECORD LOCKS

NOTES:  Table 14-2 illustrates DS accessing with RECORD LOCKS enabled for all users (assuming no other queued environments are established by any of the users).

JOB
ACCESS FOR
DATA SET IS
JOB IS
1
Update
open
running
2
Input
open
running
3
Input
open
running
4
Update
open
queued
5
Input
open
queued
6
Supersede
busy
waiting
7
Input
open
queued

Table 14-2 Simple Queued Environment

All the jobs requested access to the same DS.  The request order is reflected by the job numbers.  While Job 1 has the DS opened for update, only Jobs 2 and 3 can concurrently access it for input (reading data).

Job 4 has successfully opened the DS and is queued.  It will be allowed access when Job 1 releases the DS, since RECORD LOCKS permits only one user to update (write to a record) at a time.

Jobs 5 and 7 could run concurrent with Job 1 but can not "jump" past Job 4.  They are queued and will start when Job 4 starts.

Job 6 is attempting to supersede the DS.  ACCENT R does not queue this request.  (Job 7 appears right behind Job 5 in the queue.)  Job 6 must wait and try again periodically until all jobs (including new ones that may come in before the current jobs in the queue finish) release the DS.  Once Job 6 has access, no other job can open the DS until the supersede is finished.

SEE ALSO:  RELATE Statement