ibm-information-center/dist/eclipse/plugins/i5OS.ic.db2_5.4.0.1/rbafzmstclucu.htm

120 lines
6.5 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 xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="dc.language" scheme="rfc1766" 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. -->
<meta name="dc.date" scheme="iso8601" content="2005-09-19" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<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="keywords" content="INCLUDE statement, INCLUDE, SQL statements,
inserting into a program, declaration, SQLCA (SQL communication area) clause,
SQLDA (SQL descriptor area) clause, in INCLUDE statement, name" />
<title>INCLUDE</title>
<link rel="stylesheet" type="text/css" href="ibmidwb.css" />
<link rel="stylesheet" type="text/css" href="ic.css" />
</head>
<body>
<a id="Top_Of_Page" name="Top_Of_Page"></a><!-- Java sync-link -->
<script language = "Javascript" src = "../rzahg/synch.js" type="text/javascript"></script>
<a name="clucu"></a>
<h2 id="clucu"><a href="rbafzmst02.htm#ToC_1147">INCLUDE</a></h2><a id="idx2855" name="idx2855"></a><a id="idx2856" name="idx2856"></a><a id="idx2857" name="idx2857"></a>
<a name="inclu"></a>
<p id="inclu">The INCLUDE statement inserts declarations or statements into
a source program.</p>
<a name="wq1619"></a>
<h3 id="wq1619"><a href="rbafzmst02.htm#ToC_1148">Invocation</a></h3>
<p>This statement can only be embedded in an application program. It is not
an executable statement. It must not be specified in Java&trade; or
REXX.</p>
<a name="wq1620"></a>
<h3 id="wq1620"><a href="rbafzmst02.htm#ToC_1149">Authorization</a></h3>
<p>The authorization ID of the statement must have the system authorities
*OBJOPR and *READ on the file that contains the member.</p>
<a name="wq1621"></a>
<h3 id="wq1621"><a href="rbafzmst02.htm#ToC_1150">Syntax</a></h3>
<a href="rbafzmstclucu.htm#synsinclude"><img src="c.gif" alt="Click to skip syntax diagram" /></a>
<pre class="cgraphic"><span><img src="c.gif" alt="Read syntax diagram" longdesc="rbafzmstsyn356.htm"
border="0" /></span><a href="#skipsyn-355"><img src="c.gif" alt="Skip visual syntax diagram"
border="0" /></a>>>-INCLUDE--+-SQLCA-+------------------------------------------>&lt;
+-SQLDA-+
'-<span class="italic">name</span>--'
</pre>
<a name="skipsyn-355" id="skipsyn-355"></a>
<a name="synsinclude"></a>
<h3 id="synsinclude"><a href="rbafzmst02.htm#ToC_1151">Description</a></h3>
<dl class="parml">
<dt class="bold">SQLCA </dt><a id="idx2858" name="idx2858"></a>
<dd>Specifies the description of an SQL communication area (SQLCA) is to
be included. INCLUDE SQLCA must not be specified more than once in the same
program. Include SQLCA must not be specified if the program includes a stand-alone
SQLCODE or a stand-alone SQLSTATE.
<p>An SQLCA can be specified for C, COBOL,
and PL/I. If the SQLCA is not specified, the variable SQLCODE or SQLSTATE
must appear in the program. For more information, see <a href="rbafzmstcksql.htm#cksql">SQL return codes</a>.</p>
<p>The SQLCA should not be specified for RPG programs. In
an RPG program, the precompiler automatically includes the SQLCA.</p>
<p>For
a description of the SQLCA, see <a href="rbafzmstsqlcca.htm#sqlcca">Appendix C. SQLCA (SQL communication area)</a>.</p>
</dd>
<dt class="bold">SQLDA </dt><a id="idx2859" name="idx2859"></a>
<dd>Specifies the description of an SQL descriptor area (SQLDA) is to be
included. INCLUDE SQLDA can be specified in C, COBOL, PL/I, and ILE RPG.
<p>For a description of the SQLDA, see <a href="rbafzmstsqldda.htm#sqldda">Appendix D. SQLDA (SQL descriptor area)</a>.</p>
</dd>
<dt class="bold"><var class="pv">name</var> </dt><a id="idx2860" name="idx2860"></a>
<dd>Identifies a member to be included from the file specified on the INCFILE
parameter of the CRTSQL<span class="italic">xxx</span> command.
<p>The member
can contain any host language statements and any SQL statements other than
an INCLUDE statement. In COBOL, INCLUDE <var class="pv">member-name</var> must not be specified
in other than the DATA DIVISION or PROCEDURE DIVISION.</p>
</dd>
</dl>
<p>When your program is precompiled, the INCLUDE statement is replaced by
source statements.</p>
<p>The INCLUDE statement must be specified at a point in your program where
the resulting source statements are acceptable to the compiler.</p>
<a name="wq1622"></a>
<h3 id="wq1622"><a href="rbafzmst02.htm#ToC_1152">Notes</a></h3>
<p><span class="bold">CCSID considerations:</span> If the CCSID of the source
file specified on the SRCFILE parameter is different from the CCSID of the
source file specified on the INCFILE parameter, the source from the INCLUDE
statement is converted to the CCSID of the source file.</p>
<a name="wq1623"></a>
<h3 id="wq1623"><a href="rbafzmst02.htm#ToC_1153">Example</a></h3>
<p>Include an SQL descriptor area in a C program. </p>
<pre class="xmp"> EXEC SQL <span class="bold">INCLUDE SQLDA</span>;
EXEC SQL <span class="bold">DECLARE</span> C1 <span class="bold">CURSOR FOR</span>
<span class="bold">SELECT</span> DEPTNO, DEPTNAME, MGRNO <span class="bold">FROM</span> TDEPT
<span class="bold">WHERE</span> ADMRDEPT = 'A00';
EXEC SQL <span class="bold">OPEN</span> C1;
while (<span class="bold">SQLCODE</span>==0) {
EXEC SQL <span class="bold">FETCH</span> C1 <span class="bold">INTO</span> :dnum, :dname, mnum;
/* Print results */
}
EXEC SQL <span class="bold">CLOSE</span> C1;</pre><a id="idx2861" name="idx2861"></a><a id="idx2862" name="idx2862"></a>
<hr /><br />
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstholdloc.htm">Previous Page</a> | <a href="rbafzmstbackup.htm">Next Page</a> | <a href="rbafzmst02.htm#wq1">Contents</a> |
<a href="rbafzmstindex.htm#index">Index</a> ]
<a id="Bot_Of_Page" name="Bot_Of_Page"></a>
</body>
</html>