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

74 lines
3.9 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<?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="External file description considerations for host structure arrays in RPG/400 applications that use SQL" />
<meta name="abstract" content="Field definitions for externally described files, including renaming of fields, are recognized by the SQL precompiler." />
<meta name="description" content="Field definitions for externally described files, including renaming of fields, are recognized by the SQL precompiler." />
<meta name="DC.subject" content="external file description, host structure arrays, RPG/400, file description" />
<meta name="keywords" content="external file description, host structure arrays, RPG/400, file description" />
<meta name="DC.Relation" scheme="URI" content="rzajpexternalfilerpg.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="rzajpexfiledesrpg" />
<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>External file description considerations for host structure arrays
in RPG/400 applications
that use SQL</title>
</head>
<body id="rzajpexfiledesrpg"><a name="rzajpexfiledesrpg"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">External file description considerations for host structure arrays
in RPG/400 applications
that use SQL</h1>
<div><p>Field definitions for externally described files, including renaming
of fields, are recognized by the SQL precompiler.</p>
<div class="section"><p>The external definition form of the data structure can be used
to obtain a copy of the column names to be used as host variables.</p>
</div>
<div class="section"><p>In the following example, the DEPARTMENT table is included in
the RPG/400<sup>®</sup> program
and is used to declare a host structure array. A multiple-row FETCH statement
is then used to retrieve 10 rows into the host structure array.</p>
<pre>
*...1....+....2....+....3....+....4....+....5....+....6....*
ITDEPT E DSDEPARTMENT 10
I DEPARTMENT DEPTN
I ADMRDEPT ADMRD
C/EXEC SQL
C+ <strong>DECLARE</strong> C1 <strong>CURSOR FOR</strong>
C+ <strong>SELECT</strong> *
C+ <strong>FROM</strong> CORPDATA.DEPARTMENT
C/END-EXEC
C/EXEC SQL
C+ <strong>FETCH</strong> C1 <strong>FOR</strong> 10 <strong>ROWS INTO</strong> :TDEPT
C/END-EXEC
</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajpexternalfilerpg.htm" title="The SQL precompiler processes the RPG/400 source in much the same manner as the ILE RPG compiler. This means that the precompiler processes the /COPY statement for definitions of host variables.">Use external file descriptions in RPG/400 applications that use SQL</a></div>
</div>
</div>
</body>
</html>