128 lines
7.7 KiB
HTML
128 lines
7.7 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="reference" />
|
||
|
<meta name="DC.Title" content="Commands, statements, and operations that you cannot use in trigger programs" />
|
||
|
<meta name="abstract" content="A trigger program cannot include some commands, statements, and operations." />
|
||
|
<meta name="description" content="A trigger program cannot include some commands, statements, and operations." />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbaforzahftre.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="rbafotrgncmd" />
|
||
|
<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>Commands, statements, and operations that you cannot use in trigger
|
||
|
programs</title>
|
||
|
</head>
|
||
|
<body id="rbafotrgncmd"><a name="rbafotrgncmd"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Commands, statements, and operations that you cannot use in trigger
|
||
|
programs</h1>
|
||
|
<div><p>A trigger program cannot include some commands, statements, and
|
||
|
operations. </p>
|
||
|
<div class="section"><p>The system returns an exception if you use these: </p>
|
||
|
</div>
|
||
|
<div class="section"><div class="p"> <ul><li>The commitment definition associated with the insert, update, delete,
|
||
|
or read operation that called the trigger does not allow the COMMIT operation.
|
||
|
The COMMIT operation <em>is</em> allowed for any other commitment definition
|
||
|
in the job.</li>
|
||
|
<li>The commitment definition associated with the insert, update, delete,
|
||
|
or read operation that called the trigger does not allow the ROLLBACK operation.
|
||
|
The ROLLBACK operation <em>is</em> allowed for any other commitment definition
|
||
|
in the job.</li>
|
||
|
<li>The SQL CONNECT, DISCONNECT, SET CONNECTION, and RELEASE statements <em>are
|
||
|
not</em> allowed.</li>
|
||
|
<li>The commitment definition associated with the insert, update, delete,
|
||
|
or read operation that called the trigger does not allow the ENDCMTCTL CL
|
||
|
command. The ENDCMTCTL CL command <em>is</em> allowed for any other commitment
|
||
|
definition in the job.</li>
|
||
|
<li>An attempt to add a local API commitment resource (QTNADDCR) to the same
|
||
|
commitment definition associated with the insert, update, delete, or read
|
||
|
operation that called the trigger.</li>
|
||
|
<li>An attempt to do any input/output operation to a file that a trigger program
|
||
|
has opened with *SHARE and is the file that caused the trigger program to
|
||
|
be called.</li>
|
||
|
<li>The called trigger program that uses the same commitment definition as
|
||
|
the insert, update, delete, or read operation that called the trigger and
|
||
|
that already has an existing remote resource. However, the system puts the
|
||
|
entire transaction into a rollback-required state: <ul><li>If the trigger program fails and signals an escape message AND</li>
|
||
|
<li>Any remote resource was updated during the non-primary commit cycle for
|
||
|
either a non-<span class="keyword">iSeries™</span> location
|
||
|
or for one that is at a pre-Version 3 Release 2 level.</li>
|
||
|
<li>The trigger program can add a remote resource to the commitment definition
|
||
|
associated with the insert, update, delete, or read operation that called
|
||
|
the trigger. This allows for LU62 remote resources (protected </li>
|
||
|
<li>conversation) and DFM remote resources (DDM file open), but not DRDA<sup>®</sup> remote resources.</li>
|
||
|
<li>If a failure occurs when changing a remote resource from a trigger program,
|
||
|
the trigger program must end by signalling an escape message. This allows
|
||
|
the system to ensure that the entire transaction, for all remote locations,
|
||
|
properly rolls back. If the trigger program does not end with an escape message,
|
||
|
the databases on the various remote locations might become inconsistent.</li>
|
||
|
<li>A commit lock level of the application program is passed to the trigger
|
||
|
program. Run the trigger program under the same lock level as the application
|
||
|
program.</li>
|
||
|
<li>The trigger program and application program can run in the same or different
|
||
|
activation groups. Compile the trigger program with ACTGRP(*CALLER) to achieve
|
||
|
consistency between the trigger program and the application program.</li>
|
||
|
<li>A trigger program calls other programs or it can be nested (that is, a
|
||
|
statement in a trigger program causes the calling of another trigger program).
|
||
|
In addition, a trigger program itself can call a trigger program. The maximum
|
||
|
trigger nested level for insert, update, delete, or read is 200. When the
|
||
|
trigger program runs under commitment control, the following situations will
|
||
|
result in an error: <ul><li>Any update of the same record that has already been changed by the change
|
||
|
operation or by an operation in the trigger program.</li>
|
||
|
<li>Conflicting operations on the same record within one change operation.
|
||
|
For example, the change operation inserts a record, then the record is deleted
|
||
|
by the trigger program.</li>
|
||
|
</ul>
|
||
|
<div class="p"><div class="note"><span class="notetitle">Notes:</span> <ol><li>If the change operation is not running under commitment control, the system
|
||
|
always protects the change operation. However, the system does not monitor
|
||
|
updating the same record within the trigger program.</li>
|
||
|
<li>The ALWREPCHG(*NO|YES) parameter of the Add Physical File Trigger (ADDPFTRG)
|
||
|
command controls repeated changes under commitment control. Changing from
|
||
|
the default value to ALWREPCHG(*YES) allows the same record or updated record
|
||
|
associated with the trigger program to repeatedly change.</li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
</div>
|
||
|
</li>
|
||
|
<li>The Allow Repeated Change ALWREPCHG(*YES) parameter on the Add Physical
|
||
|
File Trigger (ADDPFTRG) command also affects trigger programs defined to be
|
||
|
called before insert and update database operations. If the trigger program
|
||
|
updates the new record in the trigger buffer and ALWREPCHG(*YES) is specified,
|
||
|
the actual insert or update operation on the associated physical file uses
|
||
|
the modified new record image. This option can be helpful in trigger programs
|
||
|
that are designed for data validation and data correction. Because the trigger
|
||
|
program receives physical file record images (even for logical files), it
|
||
|
can change any field of that record image.</li>
|
||
|
<li>The trigger program is called for each row that is changed in or read
|
||
|
from the physical file.</li>
|
||
|
<li>If the physical file or the dependent logical file is opened for insert
|
||
|
SEQONLY(*YES) processing, and the physical file has an insert trigger program
|
||
|
associated with it, the system changes the open to SEQONLY(*NO) so it can
|
||
|
call the trigger program for each row that is inserted.</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbaforzahftre.htm" title="Trigger programs can be very powerful. But you must take caution when coding trigger programs.">Precautions to take when coding trigger programs</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|