ibm-information-center/dist/eclipse/plugins/i5OS.ic.db2_5.4.0.1/rbafzmstfielddescsqlda.htm

331 lines
17 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 xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="dc.language" scheme="rfc1766" 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. -->
<meta name="dc.date" scheme="iso8601" content="2005-09-19" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<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="keywords" content="in SQLDA, data type, SQLDAID field of SQLDA,
SQLDABC field of SQLDA, SQLN field of SQLDA, SQLD field of SQLDA,
number of occurrences, SQLVAR field of SQLDA" />
<title>Field descriptions in an SQLDA header</title>
<link rel="stylesheet" type="text/css" href="ibmidwb.css" />
<link rel="stylesheet" type="text/css" href="ic.css" />
</head>
<body>
<a id="Top_Of_Page" name="Top_Of_Page"></a><!-- Java sync-link -->
<script language = "Javascript" src = "../rzahg/synch.js" type="text/javascript"></script>
<a name="fielddescsqlda"></a>
<h2 id="fielddescsqlda"><a href="rbafzmst02.htm#ToC_1497">Field descriptions in an SQLDA header</a></h2><a id="idx3440" name="idx3440"></a>
<p>An SQLDA consists of four variables in a header structure followed by an
arbitrary number of occurrences of a sequence of five variables collectively
named SQLVAR. In OPEN, CALL, FETCH, and EXECUTE, each occurrence of SQLVAR
describes a variable. In PREPARE and DESCRIBE, each occurrence describes a
column of a result table.</p>
<p>The SQL INCLUDE statement provides the following field names: </p>
<a name="fds"></a>
<table id="fds" width="100%" summary="" border="1" frame="hsides" rules="rows">
<caption>Table 92. Field Descriptions for an SQLDA Header</caption>
<thead valign="bottom">
<tr>
<th id="wq1973" width="16%" align="left" valign="bottom">
<div class="lines">C Name <sup class="fn"><a href="rbafzmstfielddescsqlda.htm#fdname1">103</a></sup><br />
PL/I Name<br />
COBOL Name<br />
</div></th>
<th id="wq1974" width="16%" align="left" valign="bottom">
<div class="lines">Field<br />
Data Type<br />
</div></th>
<th id="wq1975" width="33%" align="left" valign="bottom">Usage in DESCRIBE and PREPARE (set by
the database manager except for SQLN)</th>
<th id="wq1976" width="33%" align="left" valign="bottom">Usage in FETCH, OPEN, CALL, or EXECUTE
(set by the user prior to executing the statement)</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="left" valign="top" headers="wq1973">
<div class="lines">sqldaid<br />
SQLDAID<br />
</div><a id="idx3441" name="idx3441"></a></td>
<td align="left" valign="top" headers="wq1974">CHAR(8)</td>
<td align="left" valign="top" headers="wq1975">An 'eye catcher' for storage dumps,
containing 'SQLDA&nbsp;'.
<p>The 7th byte of the SQLDAID can be used
to determine whether more than one SQLVAR entry is needed for each column.
For details, see <a href="rbafzmstfielddescsqlda.htm#howmany">Determining how many SQLVAR occurrences are needed</a>.</p></td>
<td align="left" valign="top" headers="wq1976">A '2' in the 7th byte indicates that two
SQLVAR entries were allocated for each column.
<p>A '3' in the 7th byte indicates
that three SQLVAR entries were allocated for each column.</p>
<p>A '4' in the
7th byte indicates that four SQLVAR entries were allocated for each column.</p></td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1973">
<div class="lines">sqldabc<br />
SQLDABC<br />
</div><a id="idx3442" name="idx3442"></a></td>
<td align="left" valign="top" headers="wq1974">INTEGER</td>
<td align="left" valign="top" headers="wq1975">Length of the SQLDA.</td>
<td align="left" valign="top" headers="wq1976">Number of bytes of storage allocated for
the SQLDA. Enough storage must be allocated to contain SQLN occurrences. SQLDABC
must be set to a value greater than or equal to 16+SQLN*(80), where
80 is the length of an SQLVAR occurrence. If LOBs or distinct types are specified,
there must be two SQLVAR entries for each parameter marker.</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1973">
<div class="lines">sqln<br />
SQLN<br />
</div><a id="idx3443" name="idx3443"></a></td>
<td align="left" valign="top" headers="wq1974">SMALLINT</td>
<td align="left" valign="top" headers="wq1975">Unchanged by the database manager. Must be
set to a value greater than or equal to zero before the PREPARE or DESCRIBE
statement is executed. It should be set to a value that is greater than or
equal to the number of columns in the result or a multiple of the number of
columns in the result when multiple sets of SQLVAR entries are necessary.
Indicates the total number of occurrences of SQLVAR.</td>
<td align="left" valign="top" headers="wq1976">Total number of occurrences of SQLVAR provided
in the SQLDA. SQLN must be set to a value greater than or equal to zero.
<p>If LOBs or distinct types are specified, there must be two SQLVAR entries
for each parameter marker and SQLN must be set to two times the number of
parameter markers.</p></td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1973">
<div class="lines">sqld<br />
SQLD<br />
</div><a id="idx3444" name="idx3444"></a></td>
<td align="left" valign="top" headers="wq1974">SMALLINT</td>
<td align="left" valign="top" headers="wq1975">The number of columns described by occurrences
of SQLVAR (zero if the statement being described is not a select-statement).</td>
<td align="left" valign="top" headers="wq1976">Number of occurrences of SQLVAR
entries in the SQLDA that are used when executing the statement. SQLD must
be set to a value greater than or equal to zero and less than or equal to
SQLN.</td>
</tr>
</tbody>
</table>
<a name="howmany"></a>
<h3 id="howmany"><a href="rbafzmst02.htm#ToC_1498">Determining how many SQLVAR occurrences are needed</a></h3><a id="idx3445" name="idx3445"></a>
<p>The number of SQLVAR occurrences needed depends on the statement that the
SQLDA was provided for and the data types of the columns or parameters being
described. See the tables above for more information.</p>
<p>The 7th byte of SQLDAID is always set to the number of sets of SQLVARs
necessary.</p>
<p>If SQLD is not set to a sufficient number of SQLVAR occurrences: </p>
<ul>
<li>SQLD is set to the total number of SQLVAR occurrences needed for all sets.</li>
<li>A warning (SQLSTATE 01594) is returned if at least enough SQLVARs were
specified for the Base SQLVAR Entries. The Base SQLVAR entries are returned,
but no extended SQLVARs are returned.</li>
<li>A warning (SQLSTATE 01005) is returned if enough SQLVARs were not specified
for even the Base SQLVAR Entries. No SQLVAR entries are returned.</li></ul>
<p><a href="rbafzmstfielddescsqlda.htm#arraytbl">Table 93</a>, <a href="rbafzmstfielddescsqlda.htm#arraytbl2">Table 94</a>, and <a href="rbafzmstfielddescsqlda.htm#arraytbl3">Table 95</a> show
how to map the base and extended SQLVAR entries. For an SQLDA that contains
both base and extended SQLVAR entries, the base SQLVAR entries are in the
first block, followed by a block of extended SQLVAR entries, which if necessary,
are followed by a second or third block of extended SQLVAR entries. In each
block, the number of occurrences of the SQLVAR entry is equal to the value
in SQLD even though many of the extended SQLVAR entries might be unused.</p>
<a name="arraytbl"></a>
<table id="arraytbl" width="100%" summary="" border="1" frame="hsides" rules="rows">
<caption>Table 93. Contents of SQLVAR Arrays for USING NAMES, USING SYSTEM NAMES, USING LABELS or USING ANY</caption>
<thead valign="bottom">
<tr>
<th id="wq1977" width="8%" align="left" valign="bottom">LOBs</th>
<th id="wq1978" width="13%" align="left" valign="bottom">DISTINCT types</th>
<th id="wq1979" width="13%" align="left" valign="bottom">7th byte of SQLDAID</th>
<th id="wq1980" width="13%" align="left" valign="bottom">SQLN Minimum</th>
<th id="wq1981" width="13%" align="left" valign="bottom">First Set (Base)</th>
<th id="wq1982" width="13%" align="left" valign="bottom">Second Set (Extended)</th>
<th id="wq1983" width="13%" align="left" valign="bottom">Third Set (Extended)</th>
<th id="wq1984" width="13%" align="left" valign="bottom">Fourth Set (Extended)</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="left" valign="top" headers="wq1977">No</td>
<td align="left" valign="top" headers="wq1978">No</td>
<td align="left" valign="top" headers="wq1979">Blank</td>
<td align="left" valign="top" headers="wq1980">n</td>
<td align="left" valign="top" headers="wq1981">Column names, system column names, or labels</td>
<td align="left" valign="top" headers="wq1982">Not used</td>
<td align="left" valign="top" headers="wq1983">Not used</td>
<td align="left" valign="top" headers="wq1984">Not used</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1977">Yes</td>
<td align="left" valign="top" headers="wq1978">No</td>
<td align="left" valign="top" headers="wq1979">2</td>
<td align="left" valign="top" headers="wq1980">2n</td>
<td align="left" valign="top" headers="wq1981">Column names, system column names, or labels</td>
<td align="left" valign="top" headers="wq1982">LOBs</td>
<td align="left" valign="top" headers="wq1983">Not used</td>
<td align="left" valign="top" headers="wq1984">Not used</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1977">No</td>
<td align="left" valign="top" headers="wq1978">Yes</td>
<td align="left" valign="top" headers="wq1979">2</td>
<td align="left" valign="top" headers="wq1980">2n</td>
<td align="left" valign="top" headers="wq1981">Column names, system column names, or labels</td>
<td align="left" valign="top" headers="wq1982">Distinct types</td>
<td align="left" valign="top" headers="wq1983">Not used</td>
<td align="left" valign="top" headers="wq1984">Not used</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1977">Yes</td>
<td align="left" valign="top" headers="wq1978">Yes</td>
<td align="left" valign="top" headers="wq1979">2</td>
<td align="left" valign="top" headers="wq1980">2n</td>
<td align="left" valign="top" headers="wq1981">Column names, system column names, or labels</td>
<td align="left" valign="top" headers="wq1982">LOBs and distinct types</td>
<td align="left" valign="top" headers="wq1983">Not used</td>
<td align="left" valign="top" headers="wq1984">Not used</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<a name="arraytbl2"></a>
<table id="arraytbl2" width="100%" summary="" border="1" frame="hsides" rules="rows">
<caption>Table 94. Contents of SQLVAR Arrays for USING BOTH</caption>
<thead valign="bottom">
<tr>
<th id="wq1985" width="8%" align="left" valign="bottom">LOBs</th>
<th id="wq1986" width="13%" align="left" valign="bottom">DISTINCT types</th>
<th id="wq1987" width="13%" align="left" valign="bottom">7th byte of SQLDAID</th>
<th id="wq1988" width="13%" align="left" valign="bottom">SQLN Minimum</th>
<th id="wq1989" width="13%" align="left" valign="bottom">First Set (Base)</th>
<th id="wq1990" width="13%" align="left" valign="bottom">Second Set (Extended)</th>
<th id="wq1991" width="13%" align="left" valign="bottom">Third Set (Extended)</th>
<th id="wq1992" width="13%" align="left" valign="bottom">Fourth Set (Extended)</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="left" valign="top" headers="wq1985">No</td>
<td align="left" valign="top" headers="wq1986">No</td>
<td align="left" valign="top" headers="wq1987">2</td>
<td align="left" valign="top" headers="wq1988">2n</td>
<td align="left" valign="top" headers="wq1989">Column names</td>
<td align="left" valign="top" headers="wq1990">Labels</td>
<td align="left" valign="top" headers="wq1991">Not used</td>
<td align="left" valign="top" headers="wq1992">Not used</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1985">Yes</td>
<td align="left" valign="top" headers="wq1986">No</td>
<td align="left" valign="top" headers="wq1987">2</td>
<td align="left" valign="top" headers="wq1988">2n</td>
<td align="left" valign="top" headers="wq1989">Column names</td>
<td align="left" valign="top" headers="wq1990">LOBs and labels</td>
<td align="left" valign="top" headers="wq1991">Not used</td>
<td align="left" valign="top" headers="wq1992">Not used</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1985">No</td>
<td align="left" valign="top" headers="wq1986">Yes</td>
<td align="left" valign="top" headers="wq1987">3</td>
<td align="left" valign="top" headers="wq1988">3n</td>
<td align="left" valign="top" headers="wq1989">Column names</td>
<td align="left" valign="top" headers="wq1990">Distinct types</td>
<td align="left" valign="top" headers="wq1991">Labels</td>
<td align="left" valign="top" headers="wq1992">Not used</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1985">Yes</td>
<td align="left" valign="top" headers="wq1986">Yes</td>
<td align="left" valign="top" headers="wq1987">3</td>
<td align="left" valign="top" headers="wq1988">3n</td>
<td align="left" valign="top" headers="wq1989">Column names</td>
<td align="left" valign="top" headers="wq1990">LOBs and distinct types</td>
<td align="left" valign="top" headers="wq1991">Labels</td>
<td align="left" valign="top" headers="wq1992">Not used</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<a name="arraytbl3"></a>
<table id="arraytbl3" width="100%" summary="" border="1" frame="hsides" rules="rows">
<caption>Table 95. Contents of SQLVAR Arrays for USING ALL</caption>
<thead valign="bottom">
<tr>
<th id="wq1993" width="8%" align="left" valign="bottom">LOBs</th>
<th id="wq1994" width="13%" align="left" valign="bottom">DISTINCT types</th>
<th id="wq1995" width="13%" align="left" valign="bottom">7th byte of SQLDAID</th>
<th id="wq1996" width="13%" align="left" valign="bottom">SQLN Minimum</th>
<th id="wq1997" width="13%" align="left" valign="bottom">First Set (Base)</th>
<th id="wq1998" width="13%" align="left" valign="bottom">Second Set (Extended)</th>
<th id="wq1999" width="13%" align="left" valign="bottom">Third Set (Extended)</th>
<th id="wq2000" width="13%" align="left" valign="bottom">Fourth Set (Extended)</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="left" valign="top" headers="wq1993">No</td>
<td align="left" valign="top" headers="wq1994">No</td>
<td align="left" valign="top" headers="wq1995">3</td>
<td align="left" valign="top" headers="wq1996">3n</td>
<td align="left" valign="top" headers="wq1997">System column names</td>
<td align="left" valign="top" headers="wq1998">Labels</td>
<td align="left" valign="top" headers="wq1999">Column names</td>
<td align="left" valign="top" headers="wq2000">Not used</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1993">Yes</td>
<td align="left" valign="top" headers="wq1994">No</td>
<td align="left" valign="top" headers="wq1995">3</td>
<td align="left" valign="top" headers="wq1996">3n</td>
<td align="left" valign="top" headers="wq1997">System column names</td>
<td align="left" valign="top" headers="wq1998">LOBs and labels</td>
<td align="left" valign="top" headers="wq1999">Column names</td>
<td align="left" valign="top" headers="wq2000">Not used</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1993">No</td>
<td align="left" valign="top" headers="wq1994">Yes</td>
<td align="left" valign="top" headers="wq1995">4</td>
<td align="left" valign="top" headers="wq1996">4n</td>
<td align="left" valign="top" headers="wq1997">System column names</td>
<td align="left" valign="top" headers="wq1998">Distinct types</td>
<td align="left" valign="top" headers="wq1999">Labels</td>
<td align="left" valign="top" headers="wq2000">Column names</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1993">Yes</td>
<td align="left" valign="top" headers="wq1994">Yes</td>
<td align="left" valign="top" headers="wq1995">4</td>
<td align="left" valign="top" headers="wq1996">4n</td>
<td align="left" valign="top" headers="wq1997">System column names</td>
<td align="left" valign="top" headers="wq1998">LOBs and distinct types</td>
<td align="left" valign="top" headers="wq1999">Labels</td>
<td align="left" valign="top" headers="wq2000">Column names</td>
</tr>
</tbody>
</table>
<hr /><div class="fnnum"><a id="fdname1" name="fdname1">103</a>.</div>
<div class="fntext">In this column, the lowercase name is the C Name. The uppercase name is the
COBOL, PL/I, or RPG Name.</div>
<br />
<hr /><br />
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstsqldda.htm">Previous Page</a> | <a href="rbafzmstsqlvaroc.htm">Next Page</a> | <a href="rbafzmst02.htm#wq1">Contents</a> |
<a href="rbafzmstindex.htm#index">Index</a> ]
<a id="Bot_Of_Page" name="Bot_Of_Page"></a>
</body>
</html>