90 lines
5.2 KiB
HTML
90 lines
5.2 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="Use host structures in PL/I applications that use SQL" />
|
|
<meta name="abstract" content="In PL/I programs, you can define a host structure, 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." />
|
|
<meta name="description" content="In PL/I programs, you can define a host structure, 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." />
|
|
<meta name="DC.subject" content="PL/I program, host structure, declaring, PL/I" />
|
|
<meta name="keywords" content="PL/I program, host structure, declaring, PL/I" />
|
|
<meta name="DC.Relation" scheme="URI" content="rzajpplone.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rzajphostapppli.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rzajphostindicatorpli.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="rzajphoststrucpli" />
|
|
<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>Use host structures in PL/I applications that use SQL</title>
|
|
</head>
|
|
<body id="rzajphoststrucpli"><a name="rzajphoststrucpli"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Use host structures in PL/I applications that use SQL</h1>
|
|
<div><p>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.</p>
|
|
<div class="section"><p> For example:</p>
|
|
<pre>DCL 1 A,
|
|
2 B,
|
|
3 C1 CHAR(...),
|
|
3 C2 CHAR(...);</pre>
|
|
</div>
|
|
<div class="section"><p>In this example, B is the name of a host structure consisting
|
|
of the elementary items C1 and C2.</p>
|
|
</div>
|
|
<div class="section"><p>You can use the structure name as shorthand notation for a list
|
|
of scalars. You can qualify a host variable with a structure name (for example,
|
|
STRUCTURE.FIELD). Host structures are limited to two levels. (For example,
|
|
in the above host structure example, the A cannot be referred to in SQL.)
|
|
A structure cannot contain an intermediate level structure. In the previous
|
|
example, A could not be used as a host variable or referred to in an SQL statement.
|
|
However, B is the first level structure. B can be referred to in an SQL statement.
|
|
A host structure for SQL data is two levels deep and can be thought of as
|
|
a named set of host variables. After the host structure is defined, you can
|
|
refer to it in an SQL statement instead of listing the several host variables
|
|
(that is, the names of the host variables that make up the host structure).</p>
|
|
</div>
|
|
<div class="section"><p>For example, you can retrieve all column values from selected
|
|
rows of the table CORPDATA.EMPLOYEE with:</p>
|
|
<pre>DCL 1 PEMPL,
|
|
5 EMPNO CHAR(6),
|
|
5 FIRSTNME CHAR(12) VAR,
|
|
5 MIDINIT CHAR(1),
|
|
5 LASTNAME CHAR(15) VAR,
|
|
5 WORKDEPT CHAR(3);
|
|
…
|
|
EMPID = '000220';
|
|
…
|
|
EXEC SQL
|
|
<strong>SELECT</strong> *
|
|
<strong>INTO</strong> :PEMPL
|
|
<strong>FROM</strong> CORPDATA.EMPLOYEE
|
|
<strong>WHERE</strong> EMPNO = :EMPID;</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<ul class="ullinks">
|
|
<li class="ulchildlink"><strong><a href="rzajphostapppli.htm">Host structures in PL/I applications that use SQL</a></strong><br />
|
|
This figure shows the syntax for valid host structure declarations.</li>
|
|
<li class="ulchildlink"><strong><a href="rzajphostindicatorpli.htm">Host structure indicator arrays in PL/I applications that use SQL</a></strong><br />
|
|
This figure shows the syntax for valid indicator arrays.</li>
|
|
</ul>
|
|
|
|
<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>
|
|
</body>
|
|
</html> |