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

87 lines
6.2 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 ILE RPG applications that use SQL" />
<meta name="abstract" content="Field definitions for externally described files, including renaming of fields, are recognized by the SQL precompiler. The external definition form of the data structure can be used to obtain a copy of the column names to be used as host variables." />
<meta name="description" content="Field definitions for externally described files, including renaming of fields, are recognized by the SQL precompiler. The external definition form of the data structure can be used to obtain a copy of the column names to be used as host variables." />
<meta name="DC.subject" content="file description, external, ILE RPG, external file description, host variable, ILE RPG, ILE RPG program, external file description, externally described, /COPY statement, /COPY, ILE RPG, precompiler parameter, OPTION(*CVTDT), *CVTDT, *NOCVTDT" />
<meta name="keywords" content="file description, external, ILE RPG, external file description, host variable, ILE RPG, ILE RPG program, external file description, externally described, /COPY statement, /COPY, ILE RPG, precompiler parameter, OPTION(*CVTDT), *CVTDT, *NOCVTDT" />
<meta name="DC.Relation" scheme="URI" content="rzajprpgi.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpirpgexternal.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="rzajpexternalirpg" />
<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 ILE RPG applications
that use SQL</title>
</head>
<body id="rzajpexternalirpg"><a name="rzajpexternalirpg"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Use external file descriptions in ILE RPG applications
that use SQL</h1>
<div><p>Field definitions for externally described files, including renaming
of fields, are recognized by the SQL precompiler. The external definition
form of the data structure can be used to obtain a copy of the column names
to be used as host variables.</p>
<div class="section"><p>How date and time field definition are retrieved and processed
by the SQL precompiler depends on whether *NOCVTDT or *CVTDT is specified
on the OPTION parameter of the CRTSQLRPGI command. If *NOCVTDT is specified,
then date and time field definitions are retrieved including the format and
separator. If *CVTDT is specified, then the format and separator is ignored
when date and time field definitions are retrieved, and the precompiler assumes
that the variable declarations are date/time host variables in character format.
*CVTDT is a compatibility option for the ILE RPG precompiler.</p>
</div>
<div class="section"><p>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 class="section"><p>In the following example, the sample table DEPARTMENT is used
as a file in an ILE RPG program. The SQL precompiler retrieves the field (column)
definitions for DEPARTMENT for use as host variables.</p>
<pre>FDEPARTMENTIP E DISK RENAME(ORIGREC:DEPTREC)
</pre>
</div>
<div class="section"> <div class="note"><span class="notetitle">Note:</span> Code an F-spec for a file in your ILE RPG program only if
you use ILE RPG statements to do I/O operations to the file. If you use only
SQL statements to do I/O operations to the file, you can include the external
definition of the file (table) by using an external data structure.</div>
</div>
<div class="section"><p>In the following example, the sample table is specified as an
external data structure. The SQL precompiler retrieves the field (column)
definitions as subfields of the data structure. Subfield names can be used
as host variable names, and the data structure name TDEPT can be used as a
host structure name. The example shows that the field names can be renamed
if required by the program.</p>
<pre>DTDEPT E DS EXTNAME(DEPARTMENT)
D DEPTN E EXTFLD(DEPTNAME)
D ADMRD E EXTFLD(ADMRDEPT)</pre>
</div>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rzajpirpgexternal.htm">External file description considerations for host structure arrays in ILE RPG applications that use SQL</a></strong><br />
For device files, if INDARA was not specified and the file contains indicators, the declaration is not used as a host structure array. The indicator area is included in the structure that is generated and would cause the storage to be separated.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajprpgi.htm" title="This topic describes the unique application and coding requirements for embedding SQL statements in an ILE RPG program. The coding requirements for host variables are defined.">Code SQL statements in ILE RPG applications</a></div>
</div>
</div>
</body>
</html>