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

94 lines
4.4 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="Example of the SQLDA for a multiple row-area fetch in ILE RPG applications that use SQL" />
<meta name="abstract" content="The following is an example of the SQLDA for a multiple row-area fetch in ILE RPG." />
<meta name="description" content="The following is an example of the SQLDA for a multiple row-area fetch in ILE RPG." />
<meta name="DC.subject" content="ILE RPG program, SQLDA, example, FETCH statement, multiple-row, ILE RPG, dynamic SQL, FETCH, multiple-row, ILE RPG, coding SQL statements, application program, ILE RPG" />
<meta name="keywords" content="ILE RPG program, SQLDA, example, FETCH statement, multiple-row, ILE RPG, dynamic SQL, FETCH, multiple-row, ILE RPG, coding SQL statements, application program, ILE RPG" />
<meta name="DC.Relation" scheme="URI" content="rzajprpgi.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="rzajpexampsqldairpg" />
<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>Example of the SQLDA for a multiple row-area fetch in ILE RPG applications
that use SQL</title>
</head>
<body id="rzajpexampsqldairpg"><a name="rzajpexampsqldairpg"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example of the SQLDA for a multiple row-area fetch in ILE RPG applications
that use SQL</h1>
<div><p>The following is an example of the SQLDA for a multiple row-area
fetch in ILE RPG.</p>
<div class="example"> <pre>C/EXEC SQL <strong>INCLUDE SQLDA</strong>
C/END-EXEC
DDEPARTMENT DS OCCURS(10)
D DEPTNO 01 03A
D DEPTNM 04 32A
D MGRNO 33 38A
D ADMRD 39 41A
DIND_ARRAY DS OCCURS(10)
D INDS 4B 0 DIM(4)
C* setup number of sqlda entries and length of the sqlda
C eval sqld = 4
C eval sqln = 4
C eval sqldabc = 336
C*
C* setup the first entry in the sqlda
C*
C eval sqltype = 453
C eval sqllen = 3
C eval sql_var(1) = sqlvar
C*
C* setup the second entry in the sqlda
C*
C eval sqltype = 453
C eval sqllen = 29
C eval sql_var(2) = sqlvar
C*
C* setup the forth entry in the sqlda
C*
C eval sqltype = 453
C eval sqllen = 3
C eval sql_var(4) = sqlvar
C/EXEC SQL
C+ <strong>DECLARE</strong> C1 <strong>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</strong>
C+ <strong>USING DESCRIPTOR</strong> :SQLDA
C+ <strong>INTO</strong> :DEPARTMENT:IND_ARRAY
C/END-EXEC</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajprpgi.htm" title="This topic describes the unique application and coding requirements for embedding SQL statements in an ILE RPG program. The coding requirements for host variables are defined.">Code SQL statements in ILE RPG applications</a></div>
</div>
</div>
</body>
</html>