75 lines
4.7 KiB
HTML
75 lines
4.7 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="Indicator variables used with host structures" />
|
|
<meta name="abstract" content="You can also specify an indicator structure (defined as an array of halfword integer variables) to support a host structure." />
|
|
<meta name="description" content="You can also specify an indicator structure (defined as an array of halfword integer variables) to support a host structure." />
|
|
<meta name="DC.subject" content="indicator structure, definitions, indicator structure, indicator variable, used with host structure, example, host structure, using indicator variable with, example, variable, use of indicator with host structure, example, examples, with host structure, concept, host language, using SQL with, host structure" />
|
|
<meta name="keywords" content="indicator structure, definitions, indicator structure, indicator variable, used with host structure, example, host structure, using indicator variable with, example, variable, use of indicator with host structure, example, examples, with host structure, concept, host language, using SQL with, host structure" />
|
|
<meta name="DC.Relation" scheme="URI" content="rzajpindvar.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="rzajphostindvar" />
|
|
<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>Indicator variables used with host structures</title>
|
|
</head>
|
|
<body id="rzajphostindvar"><a name="rzajphostindvar"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Indicator variables used with host structures</h1>
|
|
<div><p>You can also specify an <em>indicator structure</em> (defined
|
|
as an array of halfword integer variables) to support a host structure.</p>
|
|
<div class="section"><p>If the results column values returned to a host structure can
|
|
be null, you can add an indicator structure name to the host structure name.
|
|
This allows SQL to notify your program about each null value returned to a
|
|
host variable in the host structure.</p>
|
|
</div>
|
|
<div class="section"><p>For example, in COBOL: </p>
|
|
<pre>01 SAL-REC.
|
|
10 MIN-SAL PIC S9(6)V99 USAGE COMP-3.
|
|
10 AVG-SAL PIC S9(6)V99 USAGE COMP-3.
|
|
10 MAX-SAL PIC S9(6)V99 USAGE COMP-3.
|
|
01 SALTABLE.
|
|
02 SALIND PIC S9999 USAGE COMP-4 OCCURS 3 TIMES.
|
|
01 EDUC-LEVEL PIC S9999 COMP-4.
|
|
…
|
|
MOVE 20 TO EDUC-LEVEL.
|
|
…
|
|
EXEC SQL
|
|
<strong>SELECT MIN</strong>(SALARY), <strong>AVG</strong>(SALARY), <strong>MAX</strong>(SALARY)
|
|
<strong>INTO</strong> :SAL-REC:SALIND
|
|
<strong>FROM</strong> CORPDATA.EMPLOYEE
|
|
<strong>WHERE</strong> EDLEVEL>:EDUC-LEVEL
|
|
END-EXEC.</pre>
|
|
</div>
|
|
<div class="section"><p>In this example, SALIND is an array containing three values, each
|
|
of which can be tested for a negative value. If, for example, SALIND(1) contains
|
|
a negative value, then the corresponding host variable in the host structure
|
|
(that is, MIN-SAL) is not changed for the selected row.</p>
|
|
</div>
|
|
<div class="section"><p>In the above example, SQL selects the column values of the row
|
|
into a host structure. Therefore, you must use a corresponding structure for
|
|
the indicator variables to determine which (if any) selected column values
|
|
are null.</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajpindvar.htm" title="An indicator variable is a halfword integer variable used to indicate whether its associated host variable has been assigned a null value.">Indicator variables in applications that use SQL</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |