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

148 lines
8.9 KiB
HTML
Raw 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="Use SQL descriptor areas in REXX applications" />
<meta name="abstract" content="There are two types of SQL descriptor areas. One is defined with the ALLOCATE DESCRIPTOR statement. The other is defined using the SQL descriptor area (SQLDA) structure. Only the SQLDA form is discussed here. Allocated descriptors are not supported in REXX." />
<meta name="description" content="There are two types of SQL descriptor areas. One is defined with the ALLOCATE DESCRIPTOR statement. The other is defined using the SQL descriptor area (SQLDA) structure. Only the SQLDA form is discussed here. Allocated descriptors are not supported in REXX." />
<meta name="DC.subject" content="SQLDA (SQL descriptor area), REXX, descriptor-name, in REXX, statement-name, in DESCRIBE, SQLD field of SQLDA, SQLNAME field of SQLDA, SQLTYPE field of SQLDA, SQLLEN field of SQLDA, SQLPRECISION field of SQLDA, SQLSCALE field of SQLDA, SQLDATA field of SQLDA, SQLIND field of SQLDA" />
<meta name="keywords" content="SQLDA (SQL descriptor area), REXX, descriptor-name, in REXX, statement-name, in DESCRIBE, SQLD field of SQLDA, SQLNAME field of SQLDA, SQLTYPE field of SQLDA, SQLLEN field of SQLDA, SQLPRECISION field of SQLDA, SQLSCALE field of SQLDA, SQLDATA field of SQLDA, SQLIND field of SQLDA" />
<meta name="DC.Relation" scheme="URI" content="rzajprexx.htm" />
<meta name="DC.Relation" scheme="URI" content="../db2/rbafzmstsqldda.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="rzajprsqlda" />
<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 SQL descriptor areas in REXX applications</title>
</head>
<body id="rzajprsqlda"><a name="rzajprsqlda"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Use SQL descriptor areas in REXX applications</h1>
<div><p><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 SQL descriptor area (SQLDA) structure. Only the SQLDA form
is discussed here. Allocated descriptors are not supported in REXX.<img src="./deltaend.gif" alt="End of change" /></span></p>
<div class="section"><p><img src="./delta.gif" alt="Start of change" />The following statements can use an SQLDA:<img src="./deltaend.gif" alt="End of change" /></p>
<ul><li>EXECUTE...USING DESCRIPTOR <span class="synph"><span class="var">descriptor-name</span></span></li>
<li>FETCH...USING DESCRIPTOR <span class="synph"><span class="var">descriptor-name</span></span></li>
<li>OPEN...USING DESCRIPTOR <span class="synph"><span class="var">descriptor-name</span></span></li>
<li>CALL...USING DESCRIPTOR <span class="synph"><span class="var">descriptor-name</span></span></li>
<li>DESCRIBE <span class="synph"><span class="var">statement-name</span></span> INTO <span class="synph"><span class="var">descriptor-name</span></span></li>
<li>DESCRIBE TABLE <span class="synph"><span class="var">host-variable</span></span> INTO <span class="synph"><span class="var">descriptor-name</span></span></li>
</ul>
</div>
<div class="section"><p><img src="./delta.gif" alt="Start of change" />Unlike the SQLCA, more than one SQLDA can be
in a procedure, and an SQLDA can have any valid name.<img src="./deltaend.gif" alt="End of change" /></p>
<p>Each SQLDA consists
of a set of REXX variables with a common stem, where the name of the stem
is the <em>descriptor-name</em> from the appropriate SQL statements. This must
be a simple stem; that is, the stem itself must not contain any periods. The
SQL/REXX interface automatically provides the fields of the SQLDA for each
unique descriptor name. An INCLUDE SQLDA statement is not required and is
not allowed.</p>
</div>
<div class="section"><p>The SQL/REXX interface uses the SQLDA in a manner consistent with
the typical SQL usage. However, the SQL/REXX interface maintains the fields
of the SQLDA in separate variables rather than in a contiguous data area.</p>
</div>
<div class="section"><p>The following variables are returned to the application after
a DESCRIBE, a DESCRIBE TABLE, or a PREPARE INTO statement:</p>
<dl><dt class="dlterm">stem.n.SQLNAME</dt>
<dd>The name of the nth column in the result table. <p>The following variables
must be provided by the application before an EXECUTE...USING DESCRIPTOR,
an OPEN...USING DESCRIPTOR, a CALL...USING DESCRIPTOR, or a FETCH...USING
DESCRIPTOR statement. They are returned to the application after a DESCRIBE,
a DESCRIBE TABLE, or a PREPARE INTO statement:</p>
</dd>
<dt class="dlterm">stem.SQLD</dt>
<dd>Number of variable elements that the SQLDA actually contains.</dd>
<dt class="dlterm">stem.n.SQLTYPE</dt>
<dd>An integer representing the data type of the nth element (for example,
the first element is in stem.1.SQLTYPE). <p>The following data types are not
allowed:</p>
<dl><dt class="dlterm">400/401</dt>
<dd>NUL-terminated graphic string</dd>
<dt class="dlterm">404/405</dt>
<dd>BLOB host variable</dd>
<dt class="dlterm">408/409</dt>
<dd>CLOB host variable</dd>
<dt class="dlterm">412/413</dt>
<dd>DBCLOB host variable</dd>
<dt class="dlterm">460/461</dt>
<dd>NUL-terminated character string</dd>
<dt class="dlterm">476/477</dt>
<dd>PASCAL L-string</dd>
<dt class="dlterm">496/497</dt>
<dd>Large integer (where scale is greater than 0)</dd>
<dt class="dlterm">500/501</dt>
<dd>Small integer (where scale is greater than 0)</dd>
<dt class="dlterm">504/505</dt>
<dd>DISPLAY SIGN LEADING SEPARATE</dd>
<dt class="dlterm">904/905</dt>
<dd>ROWID</dd>
<dt class="dlterm">908/909</dt>
<dd>VARBINARY host variable</dd>
<dt class="dlterm">912/913</dt>
<dd>BINARY host variable</dd>
<dt class="dlterm">916/917</dt>
<dd>BLOB file reference variable</dd>
<dt class="dlterm">920/921</dt>
<dd>CLOB file reference variable</dd>
<dt class="dlterm">924/925</dt>
<dd>DBCLOB file reference variable</dd>
<dt class="dlterm">960/961</dt>
<dd>BLOB locator</dd>
<dt class="dlterm">964/965</dt>
<dd>CLOB locator</dd>
<dt class="dlterm">968/969</dt>
<dd>DBCLOB locator</dd>
</dl>
</dd>
<dt class="dlterm">stem.n.SQLLEN</dt>
<dd>If SQLTYPE does not indicate a DECIMAL or NUMERIC data type, the maximum
length of the data contained in stem.n.SQLDATA.</dd>
<dt class="dlterm">stem.n.SQLLEN.SQLPRECISION</dt>
<dd>If the data type is DECIMAL or NUMERIC, this contains the precision of
the number. </dd>
<dt class="dlterm">stem.n.SQLLEN.SQLSCALE</dt>
<dd>If the type is DECIMAL or NUMERIC, this contains the scale of the number.</dd>
<dt class="dlterm">stem.n.SQLCCSID</dt>
<dd>The CCSID of the nth column of the data. <p>The following variables must
be provided by the application before an EXECUTE...USING DESCRIPTOR or an
OPEN...USING DESCRIPTOR statement, and they are returned to the application
after a FETCH...USING DESCRIPTOR statement. They are not used after a DESCRIBE,
a DESCRIBE TABLE, or a PREPARE INTO statement:</p>
</dd>
<dt class="dlterm">stem.n.SQLDATA</dt>
<dd>This contains the input value supplied by the application, or the output
value fetched by SQL. <p>This value is converted to the attributes specified
in SQLTYPE, SQLLEN, SQLPRECISION, and SQLSCALE. </p>
</dd>
<dt class="dlterm">stem.n.SQLIND</dt>
<dd>If the input or output value is null, this is a negative number.</dd>
</dl>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajprexx.htm" title="REXX procedures do not have to be preprocessed. At run time, the REXX interpreter passes statements that it does not understand to the current active command environment for processing.">Code SQL statements in REXX applications</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../db2/rbafzmstsqldda.htm">SQL descriptor area</a></div>
</div>
</div>
</body>
</html>