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

73 lines
5.4 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 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 in COBOL applications that use SQL" />
<meta name="abstract" content="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." />
<meta name="description" content="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." />
<meta name="DC.subject" content="COBOL program, host variable, externally described, external file description, COBOL COPY statement, external file description, COBOL, COBOL program, file description, external, COPY statement, externally described" />
<meta name="keywords" content="COBOL program, host variable, externally described, external file description, COBOL COPY statement, external file description, COBOL, COBOL program, file description, external, COPY statement, externally described" />
<meta name="DC.Relation" scheme="URI" content="rzajpcob.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpextfiledesccobol.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="rzajpexternalcobol" />
<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 in COBOL applications that use SQL</title>
</head>
<body id="rzajpexternalcobol"><a name="rzajpexternalcobol"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Use external file descriptions in COBOL applications that use SQL</h1>
<div><p>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.</p>
<div class="section"><p>If the REPLACING option is specified, only complete name replacing
is done. Var-1 is compared against the format name and the field name. If
they are equal, var-2 is used as the new name. </p>
<div class="note"><span class="notetitle">Note:</span> You cannot retrieve
host variables from file definitions that have field names which are COBOL
reserved words. You must place the COPY DDx-format statement within a COBOL
host structure.</div>
</div>
<div class="section"><p>To retrieve the definition of the sample table DEPARTMENT described
in <a href="../sqlp/rbafysamptblx.htm"><span class="keyword">DB2<sup>®</sup> UDB for iSeries™</span> sample tables</a> in the DB2 UDB
for <span class="keyword">iSeries</span> SQL Programming
Concepts topic collection, you can code the following: </p>
<pre>01 DEPARTMENT-STRUCTURE.
COPY DDS-ALL-FORMATS OF DEPARTMENT.</pre>
</div>
<div class="section"><p>A host structure named DEPARTMENT-STRUCTURE is defined with an
05 level field named DEPARTMENT-RECORD that contains four 06 level fields
named DEPTNO, DEPTNAME, MGRNO, and ADMRDEPT. These field names can be used
as host variables in SQL statements.</p>
<p>For more information about the
COBOL COPY verb, see the <em>COBOL/400<sup>®</sup> User's Guide</em> and <em>ILE COBOL Reference</em> manuals
on the <a href="http://publib.boulder.ibm.com/iseries/v5r1/ic2924/rzaqhindex.htm">V5R1
Supplemental Manuals</a><img src="www.gif" alt="Link outside information center" /> Web site.</p>
</div>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rzajpextfiledesccobol.htm">Use external file descriptions for host structure arrays in COBOL applications that use SQL</a></strong><br />
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.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajpcob.htm" title="This topic describes the unique application and coding requirements for embedding SQL statements in a COBOL program. Requirements for host structures and host variables are defined.">Code SQL statements in COBOL applications</a></div>
</div>
</div>
</body>
</html>