91 lines
7.6 KiB
HTML
91 lines
7.6 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="Code SQL statements in PL/I applications" />
|
||
|
<meta name="abstract" content="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." />
|
||
|
<meta name="description" content="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." />
|
||
|
<meta name="DC.subject" content="PL/I program, coding SQL statements, application program, PL/I" />
|
||
|
<meta name="keywords" content="PL/I program, coding SQL statements, application program, PL/I" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzajpkickoff.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzajpcodp.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzajpsqldapli.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzajpembedsqlpli.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzajphostvariablespli.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzajphoststrucpli.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzajphostarraypli.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzajppcticld.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzajpequivsqlpli.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzajpindvp.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzajppliparm.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzajpwritesqlapp.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzajpsamprog.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzajperrorandwarning.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="rzajpplone" />
|
||
|
<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>Code SQL statements in PL/I applications</title>
|
||
|
</head>
|
||
|
<body id="rzajpplone"><a name="rzajpplone"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Code SQL statements in PL/I applications</h1>
|
||
|
<div><p>This topic describes the unique application and coding requirements
|
||
|
for embedding SQL statements in an <span class="keyword">iSeries™</span> PL/I
|
||
|
program. Requirements for host structures and host variables are defined.</p>
|
||
|
<div class="note"><span class="notetitle">Note:</span> By using the code examples, you agree to the terms of the <a href="codedisclaimer.htm">Code license and disclaimer information</a>.</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<ul class="ullinks">
|
||
|
<li class="ulchildlink"><strong><a href="rzajpcodp.htm">Define the SQL communications area in PL/I applications that use SQL</a></strong><br />
|
||
|
A PL/I program that contains SQL statements must include one or both of the following:</li>
|
||
|
<li class="ulchildlink"><strong><a href="rzajpsqldapli.htm">Define SQL descriptor areas in PL/I applications that use SQL</a></strong><br />
|
||
|
<span><img src="./delta.gif" alt="Start of change" />There are two types of SQL descriptor areas.
|
||
|
One is defined with the ALLOCATE DESCRIPTOR statement. The other is defined
|
||
|
using the SQLDA structure. In this section, only the SQLDA form is discussed.<img src="./deltaend.gif" alt="End of change" /></span></li>
|
||
|
<li class="ulchildlink"><strong><a href="rzajpembedsqlpli.htm">Embed SQL statements in PL/I applications that use SQL</a></strong><br />
|
||
|
The first statement of the PL/I program must be a PROCEDURE statement.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rzajphostvariablespli.htm">Use host variables in PL/I applications that use SQL</a></strong><br />
|
||
|
All host variables used in SQL statements must be explicitly declared.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rzajphoststrucpli.htm">Use host structures in PL/I applications that use SQL</a></strong><br />
|
||
|
In PL/I programs, you can define a <strong>host structure</strong>, which
|
||
|
is a named set of elementary PL/I variables. A host structure name can be
|
||
|
a group name whose subordinate levels name elementary PL/I variables.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rzajphostarraypli.htm">Use host structure arrays in PL/I applications that use SQL</a></strong><br />
|
||
|
In PL/I programs, you can define a host structure array.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rzajppcticld.htm">Use external file descriptions in PL/I applications that use SQL</a></strong><br />
|
||
|
You can use the PL/I %INCLUDE directive to include the definitions of externally described files in a source program.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rzajpequivsqlpli.htm">Determine equivalent SQL and PL/I data types</a></strong><br />
|
||
|
The precompiler determines the base SQLTYPE and SQLLEN of host variables based on the following table.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rzajpindvp.htm">Use indicator variables in PL/I applications that use SQL</a></strong><br />
|
||
|
An indicator variable is a two-byte integer (BIN FIXED(p), where p is 1 to 15).</li>
|
||
|
<li class="ulchildlink"><strong><a href="rzajppliparm.htm">Differences in PL/I because of structure parameter passing techniques</a></strong><br />
|
||
|
The PL/I precompiler attempts to use the structure parameter passing technique, if possible. This structure parameter passing technique provides better performance for most PL/I programs using SQL.</li>
|
||
|
</ul>
|
||
|
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajpkickoff.htm" title="This topic collection explains how to create database applications in host languages that use DB2 Universal Database for iSeries SQL statements and functions.">Embedded SQL programming</a></div>
|
||
|
</div>
|
||
|
<div class="relconcepts"><strong>Related concepts</strong><br />
|
||
|
<div><a href="rzajpwritesqlapp.htm" title="You can create database applications in host languages that use DB2 UDB for iSeries SQL statements and functions.">Write applications that use SQL</a></div>
|
||
|
<div><a href="rzajperrorandwarning.htm" title="The conditions described in the following topics could produce an error or warning message during an attempted compile process.">Error and warning messages during a compile of application programs that use SQL</a></div>
|
||
|
</div>
|
||
|
<div class="relref"><strong>Related reference</strong><br />
|
||
|
<div><a href="rzajpsamprog.htm" title="This topic contains a sample application showing how to code SQL statements in each of the languages supported by the DB2 UDB for iSeries system.">Sample programs using DB2 UDB for iSeries statements</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|