238 lines
13 KiB
HTML
238 lines
13 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE html
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html lang="en-us" xml:lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="security" content="public" />
|
|
<meta name="Robots" content="index,follow" />
|
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
|
<meta name="DC.Type" content="concept" />
|
|
<meta name="DC.Title" content="Commit lock level" />
|
|
<meta name="abstract" content="The value you specify for the LCKLVL parameter on the Start Commitment Control (STRCMTCTL) command becomes the default level of record locking for database files that are opened and placed under commitment control for the commitment definition." />
|
|
<meta name="description" content="The value you specify for the LCKLVL parameter on the Start Commitment Control (STRCMTCTL) command becomes the default level of record locking for database files that are opened and placed under commitment control for the commitment definition." />
|
|
<meta name="DC.Relation" scheme="URI" content="rzakjstartcommit.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="../cl/strcmtctl.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rzakjmiscconsid.htm" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2004, 2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2004, 2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="rzakjlocklevel" />
|
|
<meta name="DC.Language" content="en-us" />
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
|
<title>Commit lock level</title>
|
|
</head>
|
|
<body id="rzakjlocklevel"><a name="rzakjlocklevel"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Commit lock level</h1>
|
|
<div><p>The value you specify for the LCKLVL parameter on the Start Commitment
|
|
Control (STRCMTCTL) command becomes the default level of record locking for
|
|
database files that are opened and placed under commitment control for the
|
|
commitment definition.</p>
|
|
<p>The default level of record locking cannot be overridden when opening local
|
|
database files. However, database files accessed by SQL use the current SQL
|
|
isolation level in effect at the time of the first SQL statement issued against
|
|
it.</p>
|
|
<p>The lock level must be specified with respect to your needs, the wait periods
|
|
allowed, and the release procedures used most often.</p>
|
|
<p>The following descriptions apply only to files that are opened under commitment
|
|
control:</p>
|
|
<dl><dt class="dlterm">*CHG Lock Level</dt>
|
|
<dd>Use this value if you want to protect changed records from changes by
|
|
other jobs running at the same time. For files that are opened under commitment
|
|
control, the lock is held for the duration of the transaction. For files not
|
|
opened under commitment control, the lock on the record is held only from
|
|
the time the record is read until the update operation is complete.</dd>
|
|
<dt class="dlterm">*CS Lock Level</dt>
|
|
<dd>Use this value to protect both changed and retrieved records from changes
|
|
by other jobs running at the same time. Retrieved records that are not changed
|
|
are protected only until they are released, or a different record is retrieved.<p>The
|
|
*CS lock level ensures that other jobs are not able to read a record for update
|
|
that this job has read. In addition, the program cannot read records for update
|
|
that have been locked with a record lock type of *UPDATE in another job until
|
|
that job accesses a different record.</p>
|
|
</dd>
|
|
<dt class="dlterm">*ALL Lock Level</dt>
|
|
<dd>Use this value to protect changed records and retrieved records that are
|
|
under commitment control from changes by other jobs running under commitment
|
|
control at the same time. Records that are retrieved or changed are protected
|
|
until the next commit or rollback operation.<p>The *ALL lock level ensures
|
|
that other jobs are not able to access a record for update that this job has
|
|
read. This is different from normal locking protocol. When the lock level
|
|
is specified as *ALL, even a record that is not read for update cannot be
|
|
accessed if it is locked with a record lock type of *UPDATE in another job.</p>
|
|
</dd>
|
|
</dl>
|
|
<p>The following table shows the duration of record locks for files under
|
|
and not under commitment control.</p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><thead align="left"><tr><th valign="top" id="d0e51">Request</th>
|
|
<th valign="top" id="d0e53">LCKLVL parameter</th>
|
|
<th valign="top" id="d0e55">Duration of lock</th>
|
|
<th valign="top" id="d0e57">Lock type</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr><td rowspan="4" valign="top" headers="d0e51 ">Read-only</td>
|
|
<td valign="top" headers="d0e53 ">No commitment control</td>
|
|
<td valign="top" headers="d0e55 ">No lock</td>
|
|
<td valign="top" headers="d0e57 ">None</td>
|
|
</tr>
|
|
<tr><td valign="top" headers="d0e53 ">*CHG</td>
|
|
<td valign="top" headers="d0e55 ">No lock</td>
|
|
<td valign="top" headers="d0e57 ">None</td>
|
|
</tr>
|
|
<tr><td valign="top" headers="d0e53 ">*CS</td>
|
|
<td valign="top" headers="d0e55 ">From read to next read, commit, or rollback</td>
|
|
<td valign="top" headers="d0e57 ">*READ</td>
|
|
</tr>
|
|
<tr><td valign="top" headers="d0e53 ">*ALL</td>
|
|
<td valign="top" headers="d0e55 ">From read to commit or rollback</td>
|
|
<td valign="top" headers="d0e57 ">*READ</td>
|
|
</tr>
|
|
<tr><td rowspan="7" valign="top" headers="d0e51 ">Read for update then update or delete<sup>1</sup></td>
|
|
<td valign="top" headers="d0e53 ">No commitment control</td>
|
|
<td valign="top" headers="d0e55 ">From read to update or delete</td>
|
|
<td valign="top" headers="d0e57 ">*UPDATE</td>
|
|
</tr>
|
|
<tr><td rowspan="2" valign="top" headers="d0e53 ">*CHG</td>
|
|
<td valign="top" headers="d0e55 ">From read to update or delete</td>
|
|
<td valign="top" headers="d0e57 ">*UPDATE</td>
|
|
</tr>
|
|
<tr><td valign="top" headers="d0e55 ">Then from update or delete to next commit or rollback<sup>2</sup></td>
|
|
<td valign="top" headers="d0e57 ">*UPDATE</td>
|
|
</tr>
|
|
<tr><td rowspan="2" valign="top" headers="d0e53 ">*CS</td>
|
|
<td valign="top" headers="d0e55 ">From read to update or delete</td>
|
|
<td valign="top" headers="d0e57 ">*UPDATE</td>
|
|
</tr>
|
|
<tr><td valign="top" headers="d0e55 ">Then from update or delete to next commit or rollback<sup>2</sup></td>
|
|
<td valign="top" headers="d0e57 ">*UPDATE</td>
|
|
</tr>
|
|
<tr><td rowspan="2" valign="top" headers="d0e53 ">*ALL</td>
|
|
<td valign="top" headers="d0e55 ">From read to update or delete</td>
|
|
<td valign="top" headers="d0e57 ">*UPDATE</td>
|
|
</tr>
|
|
<tr><td valign="top" headers="d0e55 ">Then from update or delete to next commit or rollback<sup>2</sup></td>
|
|
<td valign="top" headers="d0e57 "> </td>
|
|
</tr>
|
|
<tr><td rowspan="6" valign="top" headers="d0e51 ">Read for update then release<sup>1</sup></td>
|
|
<td valign="top" headers="d0e53 ">No commitment control</td>
|
|
<td valign="top" headers="d0e55 ">From read to release</td>
|
|
<td valign="top" headers="d0e57 ">*UPDATE</td>
|
|
</tr>
|
|
<tr><td valign="top" headers="d0e53 ">*CHG</td>
|
|
<td valign="top" headers="d0e55 ">From read to release</td>
|
|
<td valign="top" headers="d0e57 ">*UPDATE</td>
|
|
</tr>
|
|
<tr><td rowspan="2" valign="top" headers="d0e53 ">*CS</td>
|
|
<td valign="top" headers="d0e55 ">From read to release, commit, or rollback</td>
|
|
<td valign="top" headers="d0e57 ">*UPDATE</td>
|
|
</tr>
|
|
<tr><td valign="top" headers="d0e55 ">Then from release to next read, commit, or rollback</td>
|
|
<td valign="top" headers="d0e57 ">*UPDATE</td>
|
|
</tr>
|
|
<tr><td valign="top" headers="d0e53 ">*ALL</td>
|
|
<td valign="top" headers="d0e55 ">From read to release, commit, or rollback</td>
|
|
<td valign="top" headers="d0e57 ">*UPDATE</td>
|
|
</tr>
|
|
<tr><td valign="top" headers="d0e53 "> </td>
|
|
<td valign="top" headers="d0e55 ">Then from release to next commit or rollback </td>
|
|
<td valign="top" headers="d0e57 "> </td>
|
|
</tr>
|
|
<tr><td rowspan="4" valign="top" headers="d0e51 ">Add</td>
|
|
<td valign="top" headers="d0e53 ">No commitment control</td>
|
|
<td valign="top" headers="d0e55 ">No lock</td>
|
|
<td valign="top" headers="d0e57 ">None</td>
|
|
</tr>
|
|
<tr><td valign="top" headers="d0e53 ">*CHG</td>
|
|
<td valign="top" headers="d0e55 ">From add to commit or rollback</td>
|
|
<td valign="top" headers="d0e57 ">*UPDATE</td>
|
|
</tr>
|
|
<tr><td valign="top" headers="d0e53 ">*CS</td>
|
|
<td valign="top" headers="d0e55 ">From add to commit or rollback</td>
|
|
<td valign="top" headers="d0e57 ">*UPDATE</td>
|
|
</tr>
|
|
<tr><td valign="top" headers="d0e53 ">*ALL</td>
|
|
<td valign="top" headers="d0e55 ">From add to commit or rollback</td>
|
|
<td valign="top" headers="d0e57 ">*UPDATE</td>
|
|
</tr>
|
|
<tr><td rowspan="4" valign="top" headers="d0e51 ">Write direct</td>
|
|
<td valign="top" headers="d0e53 ">No commitment control</td>
|
|
<td valign="top" headers="d0e55 ">For duration of write direct</td>
|
|
<td valign="top" headers="d0e57 ">*UPDATE</td>
|
|
</tr>
|
|
<tr><td valign="top" headers="d0e53 ">*CHG</td>
|
|
<td valign="top" headers="d0e55 ">From write direct to commit or rollback</td>
|
|
<td valign="top" headers="d0e57 ">*UPDATE</td>
|
|
</tr>
|
|
<tr><td valign="top" headers="d0e53 ">*CS</td>
|
|
<td valign="top" headers="d0e55 ">From write direct to commit or rollback</td>
|
|
<td valign="top" headers="d0e57 ">*UPDATE</td>
|
|
</tr>
|
|
<tr><td valign="top" headers="d0e53 ">*ALL</td>
|
|
<td valign="top" headers="d0e55 ">From write direct to commit or rollback</td>
|
|
<td valign="top" headers="d0e57 ">*UPDATE</td>
|
|
</tr>
|
|
<tr><td colspan="4" valign="top" headers="d0e51 d0e53 d0e55 d0e57 "> <div class="note"><span class="notetitle">Note:</span> <p><sup>1</sup>If a commit or rollback
|
|
operation is performed after a read-for-update operation but before the record
|
|
is updated, deleted, or released, the record is unlocked during the commit
|
|
or rollback operation. The protection on the record is lost as soon as the
|
|
commit or rollback completes.</p>
|
|
<p><sup>2</sup>If a record is deleted but
|
|
the commit or rollback has not yet been issued for the transaction, the deleted
|
|
record does not remain locked. If the same or a different job attempts to
|
|
read the deleted record by key, the job receives a record not found indication.
|
|
However, if a unique keyed access path exists over the file, another job is
|
|
prevented from inserting or updating a record with the same unique key value
|
|
as that of the deleted record until the transaction is committed.</p>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p>A record lock type of *READ is obtained on records that are not read for
|
|
update when the lock level is *CS or *ALL. This type of lock prevents other
|
|
jobs from reading the records for update but does not prevent the records
|
|
from being accessed from a read-only operation.</p>
|
|
<p>A record lock type of *UPDATE is obtained on records that are updated,
|
|
deleted, added, or read for update. This type of lock prevents other jobs
|
|
from reading the records for update, and prevents jobs running under commitment
|
|
control with a record lock level of *CS or *ALL from accessing the records
|
|
for even a read-only operation.</p>
|
|
<p>Programs that are not using commitment control can read records locked
|
|
by another job, but cannot read records for update, regardless of the value
|
|
specified for the LCKLVL parameter.</p>
|
|
<p>The lock level, specified for a commitment definition when commitment control
|
|
is started for an activation group or for the job, applies only
|
|
to opens associated with that particular commitment definition.</p>
|
|
<div class="note"><span class="notetitle">Note:</span> The *CS and *ALL lock-level values protect you from retrieving a record
|
|
that currently has a pending change from a different job. However, the *CS
|
|
and *ALL lock-level values <var class="varname">do not</var> protect you from retrieving
|
|
a record using a program running in one activation group that currently has
|
|
a pending change from a program running in a different activation group within
|
|
the same job.</div>
|
|
<p>Within the same job, a program can change a record that has already been
|
|
changed within the current transaction as long as the record is accessed again
|
|
using the same commitment definition. When using the job-level commitment
|
|
definition, the access to the changed record can be made from a program running
|
|
within any activation group that is using the job-level commitment definition.</p>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzakjstartcommit.htm" title="To start commitment control, use the Start Commitment Control (STRCMTCTL) Command.">Start commitment control</a></div>
|
|
</div>
|
|
<div class="relconcepts"><strong>Related concepts</strong><br />
|
|
<div><a href="rzakjmiscconsid.htm" title="The topic talks about miscellaneous considerations and restrictions for commitment control.">Considerations and restrictions for commitment control</a></div>
|
|
</div>
|
|
<div class="relref"><strong>Related reference</strong><br />
|
|
<div><a href="../cl/strcmtctl.htm">Start Commitment Control (STRCMTCTL) command</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |