ibm-information-center/dist/eclipse/plugins/i5OS.ic.sqlp_5.4.0.1/rbafydrdapgm3.htm

88 lines
5.1 KiB
HTML
Raw 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="reference" />
<meta name="DC.Title" content="Source code for PGM3" />
<meta name="abstract" content="Here is the source code for PGM3." />
<meta name="description" content="Here is the source code for PGM3." />
<meta name="DC.Relation" scheme="URI" content="rbafyconnectmgmt.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="rbafydrdapgm3" />
<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>Source code for PGM3</title>
</head>
<body id="rbafydrdapgm3"><a name="rbafydrdapgm3"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Source code for PGM3</h1>
<div><p>Here is the source code for PGM3.</p>
<div class="example"> <div class="fignone"><span class="figcap">Figure 1. Source code for PGM3</span><pre>
EXEC SQL
<strong>INSERT INTO</strong> TAB <strong>VALUES</strong>(:st1);
EXEC SQL <strong>COMMIT</strong>;
....</pre>
</div>
</div>
<div class="section"><p>Commands to create program and SQL package for PGM3:</p>
<pre>CRTSQLCI OBJ(PGM3) COMMIT(*CHG) RDB(SYSD) OBJTYPE(*MODULE)
CRTPGM PGM(PGM3) ACTGRP(APPGRP)
CRTSQLPKG PGM(PGM3) RDB(SYSD)</pre>
</div>
<div class="example"> <div class="fignone"><br /><img src="rv2w577.gif" alt="REQTEXT" /><br /></div>
</div>
<div class="section"><p>In this example, PGM1 is a non-ILE program created using the CRTSQLCBL
command. This program runs in the default activation group. PGM2 is created
using the CRTSQLCI command, and it runs in a system-named activation group.
PGM3 is also created using the CRTSQLCI command, but it runs in the activation
group named APPGRP. Because APPGRP is not the default value for the ACTGRP
parameter, the CRTPGM command is issued separately. The CRTPGM command is
followed by a CRTSQLPKG command that creates the SQL package object on the
SYSD relational database. In this example, the user has not explicitly started
the job level commitment definition. SQL implicitly starts commitment control. </p>
</div>
<div class="section"> <ol><li>PGM1 is called and runs in the default activation group.</li>
<li>PGM1 connects to relational database SYSB and runs a SELECT statement.</li>
<li>PGM1 then calls PGM2, which runs in a system-named activation group.</li>
<li>PGM2 does a connect to relational database SYSC. Because PGM1 and PGM2
are in different activation groups, the connection started by PGM2 in the
system-named activation group does not disconnect the connection started by
PGM1 in the default activation group. Both connections are active. PGM2 opens
the cursor and fetches and updates a row. PGM2 is running under commitment
control, is in the middle of a unit of work, and is not at a connectable state.</li>
<li>PGM2 calls PGM3, which runs in activation group APPGRP.</li>
<li>The INSERT statement is the first statement run in activation group APPGRP.
The first SQL statement causes an implicit connect to relational database
SYSD. A row is inserted into table TAB located at relational database SYSD.
The insert is then committed. The pending changes in the system-named activation
group are not committed, because commitment control was started by SQL with
a commit scope of activation group.</li>
<li>PGM3 is then exited and control returns to PGM2. PGM2 fetches and updates
another row.</li>
<li>PGM3 is called again to insert the row. An implicit connect was done on
the first call to PGM3. It is not done on subsequent calls because the activation
group did not end between calls to PGM3. Finally, all the rows are processed
by PGM2 and the unit of work associated with the system-named activation group
is committed.</li>
</ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafyconnectmgmt.htm" title="SQL connections are managed at the activation group level. Each activation group within a job manages its own connections and these connections are not shared across activation groups.">Connection management and activation groups</a></div>
</div>
</div>
</body>
</html>