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

89 lines
7.5 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="concept" />
<meta name="DC.Title" content="Code SQL statements in COBOL applications" />
<meta name="abstract" content="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." />
<meta name="description" content="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." />
<meta name="DC.subject" content="COBOL program, coding SQL statements, application program, COBOL" />
<meta name="keywords" content="COBOL program, coding SQL statements, application program, COBOL" />
<meta name="DC.Relation" scheme="URI" content="rzajpkickoff.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpsqlcacobol.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpsqldacobol.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpembedsqlcobol.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajphostvariablescobol.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajphoststructurecobol.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpexternalcobol.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpequivsqlcobol.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpindicatorcobol.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpwritesqlapp.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpsamprog.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajperrorandwarning.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="rzajpcob" />
<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>Code SQL statements in COBOL applications</title>
</head>
<body id="rzajpcob"><a name="rzajpcob"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Code SQL statements in COBOL applications</h1>
<div><p>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.</p>
<p>The <span class="keyword">iSeries™</span> system supports
more than one COBOL compiler. The <span class="keyword">DB2<sup>®</sup> UDB Query Manager and SQL Development Kit</span> licensed
program only supports the COBOL for <span class="keyword">iSeries</span> and
ILE COBOL for <span class="keyword">iSeries</span> languages. </p>
<div class="note"><span class="notetitle">Note:</span> By using the code examples, you agree to the terms of the <a href="codedisclaimer.htm">Code license and disclaimer information</a>.</div>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rzajpsqlcacobol.htm">Define the SQL communications area in COBOL applications that use SQL</a></strong><br />
A COBOL program can be written to use the SQLCA to check return status for embedded SQL statements, or the program can use the SQL diagnostics area to check return status.</li>
<li class="ulchildlink"><strong><a href="rzajpsqldacobol.htm">Define SQL descriptor areas in COBOL applications that use SQL</a></strong><br />
<span><img src="./delta.gif" alt="Start of change" />There are two types of SQL descriptor areas.
One is defined with the ALLOCATE DESCRIPTOR statement. The other is defined
using the SQLDA structure. In this topic, only the SQLDA form is discussed.<img src="./deltaend.gif" alt="End of change" /></span></li>
<li class="ulchildlink"><strong><a href="rzajpembedsqlcobol.htm">Embed SQL statements in COBOL applications that use SQL</a></strong><br />
SQL statements can be coded in COBOL program sections as in this table.</li>
<li class="ulchildlink"><strong><a href="rzajphostvariablescobol.htm">Use host variables in COBOL applications that use SQL</a></strong><br />
All host variables used in SQL statements must be explicitly declared prior to their first use.</li>
<li class="ulchildlink"><strong><a href="rzajphoststructurecobol.htm">Use host structures in COBOL applications that use SQL</a></strong><br />
A <em>host structure</em> is a named set of host variables that is
defined in your program's DATA DIVISION.</li>
<li class="ulchildlink"><strong><a href="rzajpexternalcobol.htm">Use external file descriptions in COBOL applications that use SQL</a></strong><br />
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.</li>
<li class="ulchildlink"><strong><a href="rzajpequivsqlcobol.htm">Determine equivalent SQL and COBOL data types</a></strong><br />
The precompiler determines the base SQLTYPE and SQLLEN of host variables based on this table. If a host variable appears with an indicator variable, the SQLTYPE is the base SQLTYPE plus one.</li>
<li class="ulchildlink"><strong><a href="rzajpindicatorcobol.htm">Use indicator variables in COBOL applications that use SQL</a></strong><br />
An <em>indicator variable</em> is a two-byte integer
(PIC S9(m) USAGE BINARY, where m is from 1 to 4).</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajpkickoff.htm" title="This topic collection explains how to create database applications in host languages that use DB2 Universal Database for iSeries SQL statements and functions.">Embedded SQL programming</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="rzajpwritesqlapp.htm" title="You can create database applications in host languages that use DB2 UDB for iSeries SQL statements and functions.">Write applications that use SQL</a></div>
<div><a href="rzajperrorandwarning.htm" title="The conditions described in the following topics could produce an error or warning message during an attempted compile process.">Error and warning messages during a compile of application programs that use SQL</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="rzajpsamprog.htm" title="This topic contains a sample application showing how to code SQL statements in each of the languages supported by the DB2 UDB for iSeries system.">Sample programs using DB2 UDB for iSeries statements</a></div>
</div>
</div>
</body>
</html>