ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzakj_5.4.0.1/rzakjscope.htm

182 lines
12 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="Scope for a commitment definition" />
<meta name="abstract" content="The scope of a commitment definition determines which programs will use that commitment definition, and how locks acquired during transactions are scoped." />
<meta name="description" content="The scope of a commitment definition determines which programs will use that commitment definition, and how locks acquired during transactions are scoped." />
<meta name="DC.Relation" scheme="URI" content="rzakjcommitdef.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/unix12.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="rzakjscope" />
<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>Scope for a commitment definition</title>
</head>
<body id="rzakjscope"><a name="rzakjscope"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Scope for a commitment definition</h1>
<div><p>The <em>scope</em> of a commitment definition determines which programs
will use that commitment definition, and how locks acquired during transactions
are scoped. </p>
<p>The interface that starts the commitment definition determines the scope
of the commitment definition. There are four possible scopes for a commitment
definition, which fall under two general categories:</p>
<p><strong>Commitment definitions with job-scoped locks</strong></p>
<ul><li>Activation-group-level commitment definition</li>
<li>Job-level commitment definition</li>
<li>Explicitly named commitment definition</li>
</ul>
<p><strong>Commitment definitions with transaction-scoped locks</strong></p>
<ul><li>Transaction scoped commitment definition</li>
</ul>
<p>Commitment definitions with job-scoped locks can be used only by programs
that run in the job that started the commitment definitions. In comparison,
more than one job can use commitment definitions with transaction-scoped locks.</p>
<p>Applications typically use either activation-group-level or job-level commitment
definitions. These commitment definitions are created either explicitly with
the Start Commitment Control (STRCMTCTL) command, or implicitly by the system
when an SQL application runs with an isolation level other than *NONE.</p>
<div class="section"><h4 class="sectiontitle">Activation-group-level commitment definition</h4><p>The
most common scope is to the activation group. The activation-group-level commitment
definition is the default scope when the STRCMTCTL command explicitly starts
the commitment definition, or when an SQL application that runs with an isolation
level other than No Commit implicitly starts the commitment definition. Only
programs that run within that activation group use that commitment definition.
Many activation-group-level commitment definitions can be active for a job
at one time. However, each activation-group-level commitment definition can
be associated only with a single activation group. The programs that run within
that activation group can associate their committable changes only with that
activation-group-level commitment definition.</p>
<p>When iSeries™ Navigator,
the Work with Commitment Definitions (WRKCMTDFN) command, the Display Job
(DSPJOB) command, or the Work with Job (WRKJOB) command displays an activation-group-level
commitment definition, these fields display the following information:</p>
<ul><li>The commitment definition field displays the name of the activation group.
It shows the special value *DFTACTGRP to indicate the default activation group.</li>
<li>The activation group field displays the activation group number.</li>
<li>The job field displays the job that started the commitment definition.</li>
<li>The thread field displays *NONE.</li>
</ul>
</div>
<div class="section"><h4 class="sectiontitle">Job-level commitment definition</h4><p>A commitment definition
can be scoped to the job only by issuing STRCMTCTL CMTSCOPE(*JOB). Any program
running in an activation group that does not have an activation-group-level
commitment definition started uses the job-level commitment definition, if
it has already been started by another program for the job. You can only start
a single job-level commitment definition for a job.</p>
<p>When iSeries Navigator,
the Work with Commitment Definitions (WRKCMTDFN) command, the Display Job
(DSPJOB) command, or the Work with Job (WRKJOB) command displays a job-level
commitment definition, these fields display the following information:</p>
<ul><li>The commitment definition field displays the special value *JOB.</li>
<li>The activation group field displays a blank.</li>
<li>The job field displays the job that started the commitment definition.</li>
<li>The thread field displays *NONE.</li>
</ul>
<p>For a given activation group, the programs that run within that activation
group can use only a single commitment definition. Therefore, programs that
run within an activation group can either use the job-level or the activation-group-level
commitment definition, but not both at the same time. In a multi-threaded
job that does not use SQL server mode, transactional work for a program will
be scoped to the appropriate commitment definition with respect to the activation
group of the program, regardless of which thread performs it. If multiple
threads use the same activation group, they must cooperate to perform the
transactional work and ensure that commits and rollbacks occur at the correct
time.</p>
<p>Even when the job-level commitment definition is active for the
job, a program can still start the activation-group-level commitment definition
if no program running within that activation group has performed any commitment
control requests or operations for the job-level commitment definition. Otherwise,
you must first end the job-level commitment definition before you can start
the activation-group-level commitment definition. Commitment control requests
or operations for the job-level commitment definition that can prevent the
activation-group-level commitment definition from being started include:</p>
<ul><li>Opening (full or shared) a database file under commitment control.</li>
<li>Using the Add Commitment Resource (QTNADDCR) API to add an API commitment
resource.</li>
<li>Committing a transaction.</li>
<li>Rolling back a transaction.</li>
<li>Adding a remote resource under commitment control.</li>
<li>Using the Change Commitment Options (QTNCHGCO) API to changing commitment
options.</li>
<li>Bringing the commitment definition to a rollback required state using
the Rollback Required (QTNRBRQD) API.</li>
<li>Sending a user journal entry that includes the current commit cycle identifier
by using the Send Journal Entry (QJOSJRNE) API with the Include Commit Cycle
Identifier parameter.</li>
</ul>
<p>Likewise, if the programs within an activation group are currently
using the activation-group-level commitment definition, the commitment definition
must first be ended before programs running within that same activation group
can use the job-level commitment definition.</p>
<p>When opening a database
file, the open scope for the opened file can be either to the activation group
or to the job with one restriction: if a program is opening a file under commitment
control and the file is scoped to the job, then the program making the open
request must use the job-level commitment definition.</p>
</div>
<div class="section"><h4 class="sectiontitle">Explicitly-named commitment definition</h4><p>Explicitly-named
commitment definitions are started by the system when it needs to perform
its own commitment control transactions without affecting any transactions
used by an application. An example of a function that starts these types of
commitment definitions is the problem log. An application cannot start explicitly-named
commitment definitions.</p>
<p>When iSeries Navigator, the Work with Commitment
Definitions (WRKCMTDFN) command, the Display Job (DSPJOB) command, or the
Work with Job (WRKJOB) command display an explicitly-named commitment definition,
these fields display the following information:</p>
<ul><li>The commitment definition field displays the name given to it by the system.</li>
<li>The activation group field displays a blank.</li>
<li>The job field displays the job that started the commitment definition.</li>
<li>The thread field displays *NONE.</li>
</ul>
</div>
<div class="section"><h4 class="sectiontitle">Transaction-scoped commitment definitions</h4><p>Transaction-scoped
commitment definitions are started with the XA APIs for Transaction Scoped
Locks.</p>
<p>These APIs use commitment control protocols that are thread based
or SQL connection based, and not activation group based. In other words, the
APIs are used to associate the commitment definition with a particular thread
or SQL connection while the transactional work is performed, and to commit
or rollback the transactions. The system attaches these commitment definitions
to the threads that perform the transactional work, with respect to the API
protocols. They can be used by threads in different jobs.</p>
<p>When iSeries Navigator,
the Work with Commitment Definitions (WRKCMTDFN) command, the Display Job
(DSPJOB) command, or the Work with Job (WRKJOB) command display a transaction-scoped
commitment definition, these fields display the following information:</p>
<ul><li>The commitment definition field displays the special value *TNSOBJ.</li>
<li>The activation group field displays a blank.</li>
<li><img src="./delta.gif" alt="Start of change" />The job field displays the job that started the commitment
definition. Or, if the commitment definition is currently attached to a thread,
the thread's job is displayed.<img src="./deltaend.gif" alt="End of change" /></li>
<li>The thread field displays the thread to which the commitment definition
is attached (or *NONE if the commitment definition is not currently attached
to any thread).</li>
</ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzakjcommitdef.htm" title="You create a commitment definition when you use the Start Commitment Control (STRCMTCTL) command to start commitment control on your system. Also, DB2 Universal Database (UDB) for iSeries automatically creates a commitment definition when the isolation level is other than No Commit.">Commitment definition</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="../apis/unix12.htm">XA APIs</a></div>
</div>
</div>
</body>
</html>