ibm-information-center/dist/eclipse/plugins/i5OS.ic.dbp_5.4.0.1/rbaforzahftri.htm

76 lines
4.9 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<?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="Examples: Trigger programs" />
<meta name="abstract" content="This topic provides examples of trigger programs written in C, COBOL, and RPG." />
<meta name="description" content="This topic provides examples of trigger programs written in C, COBOL, and RPG." />
<meta name="DC.Relation" scheme="URI" content="rbaforzahftrb.htm" />
<meta name="DC.Relation" scheme="URI" content="rbaforzahftrj.htm" />
<meta name="DC.Relation" scheme="URI" content="rbaforzahftrk.htm" />
<meta name="DC.Relation" scheme="URI" content="rbaforzahftrl.htm" />
<meta name="DC.Relation" scheme="URI" content="rbaforzahftrt.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="rbaforzahftri" />
<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>Examples: Trigger programs</title>
</head>
<body id="rbaforzahftri"><a name="rbaforzahftri"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Examples: Trigger programs</h1>
<div><p>This topic provides examples of trigger programs written in C,
COBOL, and RPG.</p>
<p>The trigger programs in the following examples are triggered by write,
update, and delete operations to the ATMTRANS file. They are written in ILE
C, ILE COBOL, and RPG/400<sup>®</sup>. For an ILE RPG example, see the <a href="http://www.redbooks.ibm.com/abstracts/sg246503.html" target="_blank"> Stored
Procedures, Triggers and User Defined Functions on DB2
Universal Database™ for iSeries™</a><img src="rbpdf.gif" alt="Link to PDF" /> redbook.</p>
<div class="p">The application contains the following types of transactions.<ol><li>The application inserts three records into the ATMTRANS file which runs
an insert trigger. The insert trigger adds the correct amount to the ATMS
file and the ACCTS file to reflect the changes.</li>
<li>Next, the application makes two withdrawals, which run an update trigger: <ol type="a"><li>The application withdraws $25.00 from account number 20001 and ATM number
10001 which runs the update trigger. The update trigger subtracts $25.00 from
the ACCTS and ATMS files.</li>
<li>The application withdraws $900.00 from account number 20002 and ATM number
10002 which runs an update trigger. The update trigger signals an exception
to the application indicating that the transaction fails.</li>
</ol>
</li>
<li>Finally, the application deletes the ATM number from the ATMTRANS file
which runs a delete trigger. The delete trigger deletes the corresponding
ACCTID from the ACCTS file and ATMID from the ATMS file.</li>
</ol>
</div>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rbaforzahftrj.htm">Example: Insert trigger written in RPG</a></strong><br />
The RPG trigger program inserts records into the ATMTRANS file in this example.</li>
<li class="ulchildlink"><strong><a href="rbaforzahftrk.htm">Example: Update trigger written in ILE COBOL</a></strong><br />
This example shows the running of the ILE COBOL trigger program when a record is updated in the ATMTRANS file.</li>
<li class="ulchildlink"><strong><a href="rbaforzahftrl.htm">Example: Delete trigger written in ILE C</a></strong><br />
This example shows the running of the ILE C trigger program when a record is deleted in the ATMTRANS file.</li>
<li class="ulchildlink"><strong><a href="rbaforzahftrt.htm">Trigger programs: Data structures of database used in the examples</a></strong><br />
This topic describes the data structures that are used in this application.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbaforzahftrb.htm" title="These topics discuss how to create and work with trigger programs.">Create trigger programs</a></div>
</div>
</div>
</body>
</html>