94 lines
5.0 KiB
HTML
94 lines
5.0 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="Define the SQL communications area in PL/I applications that use SQL" />
|
|
<meta name="abstract" content="A PL/I program that contains SQL statements must include one or both of the following:" />
|
|
<meta name="description" content="A PL/I program that contains SQL statements must include one or both of the following:" />
|
|
<meta name="DC.subject" content="application program, SQLCA (SQL communication area), PL/I, SQLCA (SQL communication area), PL/I program, SQLCA, declaring, SQLCODE, declaring, SQLSTATE, declaring, SQLCODE, SQLSTATE" />
|
|
<meta name="keywords" content="application program, SQLCA (SQL communication area), PL/I, SQLCA (SQL communication area), PL/I program, SQLCA, declaring, SQLCODE, declaring, SQLSTATE, declaring, SQLCODE, SQLSTATE" />
|
|
<meta name="DC.Relation" scheme="URI" content="rzajpplone.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="../db2/rbafzmstsqlcca.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="rzajpcodp" />
|
|
<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>Define the SQL communications area in PL/I applications
|
|
that use SQL</title>
|
|
</head>
|
|
<body id="rzajpcodp"><a name="rzajpcodp"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Define the SQL communications area in PL/I applications
|
|
that use SQL</h1>
|
|
<div><p>A PL/I program that contains SQL statements must include one or
|
|
both of the following: </p>
|
|
<div class="section"><ul><li>An SQLCODE variable declared as FIXED BINARY(31)</li>
|
|
<li>An SQLSTATE variable declared as CHAR(5)</li>
|
|
</ul>
|
|
</div>
|
|
<div class="section"><p>Or,</p>
|
|
<ul><li>An SQLCA (which contains an SQLCODE and SQLSTATE variable).</li>
|
|
</ul>
|
|
</div>
|
|
<div class="section"><p>The SQLCODE and SQLSTATE values are set by the database manager
|
|
after each SQL statement is run. An application can check the SQLCODE or SQLSTATE
|
|
value to determine whether the last SQL statement was successful.</p>
|
|
</div>
|
|
<div class="section"><p>The SQLCA can be coded in a PL/I program either directly or by
|
|
using the SQL INCLUDE statement. Using the SQL INCLUDE statement requests
|
|
the inclusion of a standard SQLCA declaration: </p>
|
|
<pre>EXEC SQL <strong>INCLUDE SQLCA</strong> ;</pre>
|
|
</div>
|
|
<div class="section"><p>The scope of the SQLCODE, SQLSTATE, and SQLCA variables must include
|
|
the scope of all SQL statements in the program.</p>
|
|
</div>
|
|
<div class="section"><p>The included PL/I source statements for the SQLCA are:</p>
|
|
<pre>DCL 1 SQLCA,
|
|
2 SQLCAID CHAR(8),
|
|
2 SQLCABC FIXED(31) BINARY,
|
|
2 SQLCODE FIXED(31) BINARY,
|
|
2 SQLERRM CHAR(70) VAR,
|
|
2 SQLERRP CHAR(8),
|
|
2 SQLERRD(6) FIXED(31) BINARY,
|
|
2 SQLWARN,
|
|
3 SQLWARN0 CHAR(1),
|
|
3 SQLWARN1 CHAR(1),
|
|
3 SQLWARN2 CHAR(1),
|
|
3 SQLWARN3 CHAR(1),
|
|
3 SQLWARN4 CHAR(1),
|
|
3 SQLWARN5 CHAR(1),
|
|
3 SQLWARN6 CHAR(1),
|
|
3 SQLWARN7 CHAR(1),
|
|
3 SQLWARN8 CHAR(1),
|
|
3 SQLWARN9 CHAR(1),
|
|
3 SQLWARNA CHAR(1),
|
|
2 SQLSTATE CHAR(5);</pre>
|
|
<p>SQLCODE is replaced with SQLCADE
|
|
when a declare for SQLCODE is found in the program and the SQLCA is provided
|
|
by the precompiler. SQLSTATE is replaced with SQLSTOTE when a declare for
|
|
SQLSTATE is found in the program and the SQLCA is provided by the precompiler.</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajpplone.htm" title="This topic describes the unique application and coding requirements for embedding SQL statements in an iSeries PL/I program. Requirements for host structures and host variables are defined.">Code SQL statements in PL/I applications</a></div>
|
|
</div>
|
|
<div class="relinfo"><strong>Related information</strong><br />
|
|
<div><a href="../db2/rbafzmstsqlcca.htm">SQL communication area</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |