ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzajp_5.4.0.1/rzajphostarraypli.htm

83 lines
4.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 structure arrays in PL/I applications that use SQL" />
<meta name="abstract" content="In PL/I programs, you can define a host structure array." />
<meta name="description" content="In PL/I programs, you can define a host structure array." />
<meta name="DC.subject" content="arrays of host structures, using arrays, PL/I, host structure, PL/I program, arrays, declaring" />
<meta name="keywords" content="arrays of host structures, using arrays, PL/I, host structure, PL/I program, arrays, declaring" />
<meta name="DC.Relation" scheme="URI" content="rzajpplone.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpplihoststruc.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="rzajphostarraypli" />
<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 structure arrays in PL/I applications that use SQL</title>
</head>
<body id="rzajphostarraypli"><a name="rzajphostarraypli"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Use host structure arrays in PL/I applications that use SQL</h1>
<div><p>In PL/I programs, you can define a host structure array.</p>
<div class="section"><p>In these examples, the following are true:</p>
<ul><li>B_ARRAY is the name of a host structure array that contains the items
C1_VAR and C2_VAR.</li>
<li>B_ARRAY cannot be qualified.</li>
<li>B_ARRAY can only be used with the blocked forms of the FETCH and INSERT
statements.</li>
<li>All items in B_ARRAY must be valid host variables.</li>
<li>C1_VAR and C2_VAR are not valid host variables in any SQL statement. A
structure cannot contain an intermediate level structure. A_STRUCT cannot
contain the dimension attribute.</li>
</ul>
<pre>DCL 1 A_STRUCT,
2 B_ARRAY(10),
3 C1_VAR CHAR(20),
3 C2_FIXED BIN(15) UNALIGNED;
</pre>
</div>
<div class="section"><p>To retrieve 10 rows from the CORPDATA.DEPARTMENT table, do the
following:</p>
<pre>
DCL 1 DEPT(10),
5 DEPTPNO CHAR(3),
5 DEPTNAME CHAR(29) VAR,
5 MGRNO CHAR(6),
5 ADMRDEPT CHAR (3);
DCL 1 IND_ARRAY(10),
5 INDS(4) FIXED BIN(15);
EXEC SQL
<strong>DECLARE</strong> C1 <strong>CURSOR FOR</strong>
<strong>SELECT</strong> *
<strong>FROM</strong> CORPDATA.DEPARTMENT;
EXEC SQL
<strong>FETCH</strong> C1 <strong>FOR</strong> 10 <strong>ROWS INTO</strong> :DEPT :IND_ARRAY;
</pre>
</div>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rzajpplihoststruc.htm">Host structure array in PL/I applications that use SQL</a></strong><br />
The following syntax diagram shows the syntax for valid structure array declarations.</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>