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

82 lines
5.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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 external file descriptions for host structure arrays in COBOL applications that use SQL" />
<meta name="abstract" content="Because COBOL creates an extra level when including externally described data, the OCCURS clause must be placed on the preceding 04 level. The structure cannot contain any additional declares at the 05 level." />
<meta name="description" content="Because COBOL creates an extra level when including externally described data, the OCCURS clause must be placed on the preceding 04 level. The structure cannot contain any additional declares at the 05 level." />
<meta name="DC.subject" content="external file description, host structure arrays, COBOL, file description, host structure, using arrays" />
<meta name="keywords" content="external file description, host structure arrays, COBOL, file description, host structure, using arrays" />
<meta name="DC.Relation" scheme="URI" content="rzajpexternalcobol.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="rzajpextfiledesccobol" />
<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 external file descriptions for host structure arrays in COBOL applications
that use SQL</title>
</head>
<body id="rzajpextfiledesccobol"><a name="rzajpextfiledesccobol"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Use external file descriptions for host structure arrays in COBOL applications
that use SQL</h1>
<div><p>Because COBOL creates an extra level when including externally
described data, the OCCURS clause must be placed on the preceding 04 level.
The structure cannot contain any additional declares at the 05 level.</p>
<div class="section"><p>If the file contains fields that are generated as FILLER, the
structure cannot be used as a host structure array.</p>
</div>
<div class="section"><p>For device files, if INDARA was not specified and the file contains
indicators, the declaration cannot be used as a host structure array. The
indicator area is included in the generated structure and causes the storage
for records to not be contiguous.</p>
</div>
<div class="section"><p>For example, the following shows how to use COPYDDS to generate
a host structure array and fetch 10 rows into the host structure array:</p>
<pre>01 DEPT.
04 DEPT-ARRAY OCCURS 10 TIMES.
COPY DDS-ALL-FORMATS OF DEPARTMENT.
...
EXEC SQL <strong>DECLARE</strong> C1 <strong>CURSOR FOR</strong>
<strong>SELECT</strong> * <strong>FROM</strong> CORPDATA.DEPARTMENT
END EXEC.
EXEC SQL <strong>OPEN</strong> C1
END-EXEC.
EXEC SQL <strong>FETCH</strong> C1 <strong>FOR</strong> 10 <strong>ROWS INTO</strong> :DEPARTMENT
END-EXEC.
</pre>
<div class="note"><span class="notetitle">Note:</span> DATE, TIME, and TIMESTAMP columns will generate character
host variable definitions that are treated by SQL with the same comparison
and assignment rules as the DATE, TIME, or TIMESTAMP column. For example,
a date host variable can only be compared against a DATE column or a character
string which is a valid representation of a date. <p>Although GRAPHIC and
VARGRAPHIC are mapped to character variables in COBOL for <span class="keyword">iSeries™</span>,
SQL considers these GRAPHIC and VARGRAPHIC variables. If the GRAPHIC or VARGRAPHIC
column has a UCS-2 CCSID, the generated host variable will have the UCS-2
CCSID assigned to it. If the GRAPHIC or VARGRAPHIC column has a UTF-16 CCSID,
the generated host variable will have the UTF-16 CCSID assigned to it.</p>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajpexternalcobol.htm" title="SQL uses the COPY DD-format-name, COPY DD-ALL-FORMATS, COPY DDS-format-name, COPY DDR-format-name, COPY DDR-ALL-FORMATS, COPY DDSR-format-name, COPY DDS-ALL-FORMATS, and COPY DDSR-ALL-FORMATS to retrieve host variables from the file definitions.">Use external file descriptions in COBOL applications that use SQL</a></div>
</div>
</div>
</body>
</html>