139 lines
7.9 KiB
HTML
139 lines
7.9 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="Triggers and their relationship to CL commands" />
|
||
|
<meta name="abstract" content="Triggers interact with CL commands in several ways." />
|
||
|
<meta name="description" content="Triggers interact with CL commands in several ways." />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbaforzahftra.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="rbaforzahftrq" />
|
||
|
<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>Triggers and their relationship to CL commands</title>
|
||
|
</head>
|
||
|
<body id="rbaforzahftrq"><a name="rbaforzahftrq"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Triggers and their relationship to CL commands</h1>
|
||
|
<div><p>Triggers interact with CL commands in several ways.</p>
|
||
|
<p><strong>Save/Restore Base File (SAVOBJ/RSTOBJ)</strong></p>
|
||
|
<div class="p"> <ul><li>The Save/Restore function will not search for the trigger program during
|
||
|
save/restore time. It is your responsibility to manage the program. During
|
||
|
run time, if the system has not restored the trigger program, the system returns
|
||
|
a hard error with the trigger program name, physical file name, and trigger
|
||
|
event. </li>
|
||
|
<li><img src="./delta.gif" alt="Start of change" />If the entire library (*ALL) is saved and the file and all
|
||
|
trigger programs are in the same library and they are restored to a different
|
||
|
library, then all the trigger program names are changed in the file to reflect
|
||
|
the new library.<img src="./deltaend.gif" alt="End of change" /></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<p><strong>Save/Restore Trigger Program (SAVOBJ/RSTOBJ)</strong></p>
|
||
|
<div class="p"> <ul><li>If you restore the trigger program in a different library, the change
|
||
|
operation fails because the trigger program is not in the original library.
|
||
|
The error returns the trigger program name, physical file name, and trigger
|
||
|
event information.<div class="p">There are two ways to recover in this situation: <ul><li>Restore the trigger program to the same library</li>
|
||
|
<li>Create a new trigger program with the same name in the new library</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<p><strong>Delete File (DLTF)</strong></p>
|
||
|
<div class="p"> <ul><li><img src="./delta.gif" alt="Start of change" />If a file is deleted, the association between
|
||
|
this file and its trigger programs are removed. For system triggers, the trigger
|
||
|
programs remain on the system.<img src="./deltaend.gif" alt="End of change" /></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<p><strong>Copy File (CPYF)</strong></p>
|
||
|
<div class="p"> <ul><li>If a to-file associates with an insert trigger, each inserted record calls
|
||
|
the trigger program.</li>
|
||
|
<li>If a to-file associates with a delete trigger program and the CPYF command
|
||
|
specifies MBROPT(*REPLACE), the copy operation fails.</li>
|
||
|
<li>Copy with CREATE(*YES) does not propagate the trigger information</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<p><strong>Create Duplicate Object (CRTDUPOBJ)</strong></p>
|
||
|
<p><img src="./delta.gif" alt="Start of change" />If TRG(*NO) is specified, triggers will not be duplicated
|
||
|
in the new file. If TRG(*YES) is specified, triggers will be duplicated. The
|
||
|
following rules describe how triggers are duplicated:<img src="./deltaend.gif" alt="End of change" /></p>
|
||
|
<div class="p"> <ul><li>When a physical file and its trigger program are originally in the same
|
||
|
library, the trigger program library will always be changed to the new library,
|
||
|
even if the trigger program does not exist in the new library. In addition,
|
||
|
the following rules apply: <ul><li>If the CRTDUPOBJ command is duplicating both the physical file and its
|
||
|
trigger program to a new library, then the new trigger program will be associated
|
||
|
with the new physical file.</li>
|
||
|
<li>If the CRTDUPOBJ command is duplicating only the physical file, then the
|
||
|
trigger program with the same program name in the TO library will be associated
|
||
|
with the new physical file. This is true even if there is no trigger program
|
||
|
by that name in the TO library. The library of the trigger program will be
|
||
|
changed. </li>
|
||
|
<li>If the CRTDUPOBJ command is duplicating only the trigger program, then
|
||
|
the new trigger program will not be associated with any physical files.</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li>When a physical file and its trigger program are originally in different
|
||
|
libraries: <ul><li>The old trigger program will be associated with the new physical file.
|
||
|
Even if the new physical file is duplicated to the same library as the trigger
|
||
|
program, the old trigger program will still be associated with the new physical
|
||
|
file.</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li> A trigger program cannot be added if the program is in the QTEMP library.
|
||
|
For database files, the CRTDUPOBJ command attempts to locate the trigger program
|
||
|
in the TO library. If the CRTDUPOBJ command is used with QTEMP specified as
|
||
|
the new library, CRTDUPOBJ attempts to create as much of the object as possible.
|
||
|
The file is created, but the trigger cannot be added, so the file remains
|
||
|
in QTEMP without a member. </li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<p><strong>Clear Physical File Member (CLRPFM)</strong></p>
|
||
|
<div class="p"> <ul><li>If the physical file is associated with a delete trigger, the CLRPFM operation
|
||
|
fails.</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<p><strong>Initialize Physical File Member (INZPFM)</strong></p>
|
||
|
<div class="p"> <ul><li>If the physical file is associated with an insert trigger, the INZPFM
|
||
|
operation fails.</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<p><strong>FORTRAN Force-End-Of-Data (FEOD)</strong></p>
|
||
|
<div class="p"> <ul><li>If the physical file is associated with a delete trigger, the FEOD operation
|
||
|
fails.</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<p><strong>Apply Journaled Changes or Remove Journaled Changes (APYJRNCHG/RMVJRNCHG)</strong></p>
|
||
|
<div class="p"> <ul><li>If the physical file is associated with any type of trigger, the APYJRNCHG
|
||
|
and RMVJRNCHG operations do not call the trigger program. Therefore, you must
|
||
|
make sure to have all the files within the trigger program journaled. Then,
|
||
|
when using the APYJRNCHG or RMVJRNCHG command, make sure to specify all of
|
||
|
these files. This ensures that all the physical file changes for the application
|
||
|
program and the trigger programs are consistent. <div class="note"><span class="notetitle">Note:</span> If any trigger program
|
||
|
functions do not relate to database files and cannot be explicitly journaled,
|
||
|
send journal entries to record relevant information. Use the Send Journal
|
||
|
Entry (SNDJRNE) command or the Send Journal Entry (QJOSJRNE) API. Use this
|
||
|
information during database file recovery to ensure consistency.</div>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbaforzahftra.htm" title="A trigger is a set of actions that run automatically when a specified change or read operation is performed on a specified database file. On iSeries, you define a set of trigger actions in any supported high-level language.">Trigger automatic events in your database</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|