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

71 lines
4.0 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 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 indicator variables in C and C++ applications that use SQL" />
<meta name="abstract" content="An indicator variable is a two-byte integer (short int)." />
<meta name="description" content="An indicator variable is a two-byte integer (short int)." />
<meta name="DC.subject" content="indicator variable, C, C++, variable, C program, indicator structure, coding requirement, coding SQL statements, application program" />
<meta name="keywords" content="indicator variable, C, C++, variable, C program, indicator structure, coding requirement, coding SQL statements, application program" />
<meta name="DC.Relation" scheme="URI" content="rzajpc.htm" />
<meta name="DC.Relation" scheme="URI" content="../db2/rbafzmstch2refvar.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="rzajpindvard" />
<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 indicator variables in C and C++ applications that
use SQL</title>
</head>
<body id="rzajpindvard"><a name="rzajpindvard"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Use indicator variables in C and C++ applications that
use SQL</h1>
<div><p>An indicator variable is a two-byte integer (short int). </p>
<div class="section"><p>You can also specify an indicator structure (defined as an array
of halfword integer variables) to support a host structure. On retrieval,
an indicator variable is used to show if its associated host variable has
been assigned a null value. On assignment to a column, a negative indicator
variable is used to indicate that a null value should be assigned.</p>
</div>
<div class="section"><p>Indicator variables are declared in the same way as host variables.
The declarations of the two can be mixed in any way that seems appropriate
to you.</p>
</div>
<div class="section"><h4 class="sectiontitle"><em>Example</em></h4><p>Given the statement:</p>
<pre> EXEC SQL <strong>FETCH</strong> CLS_CURSOR <strong>INTO</strong> :ClsCd,
:Day :DayInd,
:Bgn :BgnInd,
:End :EndInd;</pre>
<p>Variables can
be declared as follows:</p>
<pre> EXEC SQL <strong>BEGIN DECLARE SECTION</strong>;
char ClsCd[8];
char Bgn[9];
char End[9];
short Day, DayInd, BgnInd, EndInd;
EXEC SQL <strong>END DECLARE SECTION</strong>;</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajpc.htm" title="This topic describes the unique application and coding requirements for embedding SQL statements in a C or C++ program.">Code SQL statements in C and C++ applications</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="../db2/rbafzmstch2refvar.htm">References to variables</a></div>
</div>
</div>
</body>
</html>