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

128 lines
6.8 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 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="ALLOCATE DESCRIPTOR statement,
ALLOCATE DESCRIPTOR, SQL statements, in ALLOCATE DESCRIPTOR statement,
SQL-descriptor-name" />
<title>ALLOCATE DESCRIPTOR</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="allocatedescr"></a>
<h2 id="allocatedescr"><a href="rbafzmst02.htm#ToC_734">ALLOCATE DESCRIPTOR</a></h2><a id="idx1274" name="idx1274"></a><a id="idx1275" name="idx1275"></a>
<p>The ALLOCATE DESCRIPTOR statement allocates an SQL descriptor.</p>
<a name="wq1030"></a>
<h3 id="wq1030"><a href="rbafzmst02.htm#ToC_735">Invocation</a></h3>
<p>This statement can only be embedded in an application program,
SQL function, SQL procedure, or trigger. It cannot be issued interactively.
It is an executable statement that cannot be dynamically prepared. It must
not be specified in REXX.</p>
<a name="wq1031"></a>
<h3 id="wq1031"><a href="rbafzmst02.htm#ToC_736">Authorization</a></h3>
<p>None required.</p>
<a name="wq1032"></a>
<h3 id="wq1032"><a href="rbafzmst02.htm#ToC_737">Syntax</a></h3>
<a href="rbafzallocatedescr.htm#synallocatedescr"><img src="c.gif" alt="Click to skip syntax diagram" /></a>
<pre class="cgraphic"><span><img src="c.gif" alt="Read syntax diagram" longdesc="rbafzmstsyn240.htm"
border="0" /></span><a href="#skipsyn-239"><img src="c.gif" alt="Skip visual syntax diagram"
border="0" /></a> .-SQL-. .-LOCAL--.
>>-ALLOCATE--+-----+--DESCRIPTOR--+--------+--<span class="italic">SQL-descriptor-name</span>-->
'-GLOBAL-'
.-WITH MAX--<span class="italic">20</span>-------------------.
>--+--------------------------------+-------------------------->&lt;
'-WITH MAX--+-<span class="italic">integer</span>----------+-'
'-<span class="italic">integer-variable</span>-'
</pre>
<a name="skipsyn-239" id="skipsyn-239"></a>
<a name="synallocatedescr"></a>
<h3 id="synallocatedescr"><a href="rbafzmst02.htm#ToC_738">Description</a></h3>
<dl class="parml">
<dt class="bold">LOCAL</dt>
<dd>Defines the scope of the name of the descriptor to be local to the program
invocation. The descriptor will not be known outside this scope. For example,
a program called from another separately compiled program cannot use a descriptor
that was allocated by the calling program. The scope of the descriptor is
also limited to the thread in which the program that contains the descriptor
is running. For example, if the same program is running in two separate threads
in the same job, the second thread cannot use a descriptor that was allocated
by the first thread.
</dd>
<dt class="bold">GLOBAL</dt>
<dd>Defines the scope of the name of the descriptor to be global to the
SQL session. The descriptor will be known to any program that executes using
the same database connection.
</dd>
<dt class="bold"><var class="pv">SQL-descriptor-name</var></dt>
<dd>Names the descriptor to allocate. The name must not be the same as a
descriptor that already exists with the specified scope.<a id="idx1276" name="idx1276"></a>
</dd>
<dt class="bold">WITH MAX</dt>
<dd>The descriptor is allocated to support the specified maximum
number of items. If this clause is not specified, the descriptor is allocated
with a maximum of 20 items.
<dl class="parml">
<dt class="bold"><var class="pv">integer</var></dt>
<dd>Specifies the number of items to allocate. The value of <var class="pv">integer</var> must be greater than zero and not greater than 8000.
</dd>
<dt class="bold"><var class="pv">integer-variable</var></dt>
<dd>Specifies an integer variable (or decimal or numeric variable
with zero scale) that contains the number of items to allocate. The value
of <var class="pv">integer-variable</var> must be greater than zero and not greater than
8000.
</dd>
</dl>
</dd>
</dl>
<a name="wq1033"></a>
<h3 id="wq1033"><a href="rbafzmst02.htm#ToC_739">Notes</a></h3>
<a name="descrpersist"></a>
<p id="descrpersist"><span class="bold">Descriptor persistence:</span> Local descriptors are implicitly deallocated
based on the CLOSQLCSR option:</p>
<ul>
<li>For ILE programs, if CLOSQLCSR(*ENDACTGRP) is specified (the default),
local descriptors are implicitly deallocated when the activation group ends.
If CLOSQLCSR(*ENDMOD) is specified, local descriptors are implicitly deallocated
on exit from the module.</li>
<li>For OPM programs, if CLOSQLCSR(*ENDPGM) is specified (the default), local
descriptors are implicitly deallocated when the program ends. If CLOSQLCSR(*ENDSQL)
is specified, local descriptors are implicitly deallocated when the first
SQL program on the call stack ends. If CLOSQLCSR(*ENDJOB) is specified, local
descriptors are implicitly deallocated when the job ends.</li></ul>
<p>Global descriptors are implicitly deallocated when the activation group
ends.</p>
<p>Both local and global descriptors can be explicitly deallocated
using the DEALLOCATE DESCRIPTOR statement.</p>
<a name="wq1034"></a>
<h3 id="wq1034"><a href="rbafzmst02.htm#ToC_740">Examples</a></h3>
<p>Allocate a descriptor called 'NEWDA' large enough to hold 20
items. </p>
<pre class="xmp"> EXEC SQL <span class="bold">ALLOCATE DESCRIPTOR</span> 'NEWDA'
<span class="bold">WITH MAX</span> 20</pre>
<hr /><br />
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstsqcomm.htm">Previous Page</a> | <a href="rbafzmstaproceduree.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>