ibm-information-center/dist/eclipse/plugins/i5OS.ic.rbam6_5.4.0.1/decla.htm

124 lines
7.0 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="task" />
<meta name="DC.Title" content="Declare a file" />
<meta name="abstract" content="The Declare File (DCLF) command is used to declare a display or database file to your CL procedure or program. The DCLF command cannot be used to declare files such as tape, printer, and mixed files." />
<meta name="description" content="The Declare File (DCLF) command is used to declare a display or database file to your CL procedure or program. The DCLF command cannot be used to declare files such as tape, printer, and mixed files." />
<meta name="DC.subject" content="DCLF (Declare File) command, declaring, variable, Declare File (DCLF) command, command, CL, DCLF (Declare File), using, Declare File (DCLF), file, in CL program, for file, for field, example, declaring display file, DDS, display file, display file, creating" />
<meta name="keywords" content="DCLF (Declare File) command, declaring, variable, Declare File (DCLF) command, command, CL, DCLF (Declare File), using, Declare File (DCLF), file, in CL program, for file, for field, example, declaring display file, DDS, display file, display file, creating" />
<meta name="DC.Relation" scheme="URI" content="wfile.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/dclf.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="decla" />
<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>Declare a file</title>
</head>
<body id="decla"><a name="decla"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Declare a file</h1>
<div><p>The <span class="cmdname">Declare File (DCLF)</span> command is used to declare
a display or database file to your CL procedure or program. The DCLF command
cannot be used to declare files such as tape, printer, and mixed files.</p>
<div class="section"> <p> You can declare up to five files in a CL procedure or OPM program.
The DCLF command has the following parameters:</p>
<pre> DCLF FILE(library-name/file-name)
RCDFMT(record-format-names)
OPNID(open_id_name)</pre>
<p>Note that the file must exist before the module or program
is compiled.</p>
<p>If you are using a display file in your procedure or program,
you may have to specify input and output fields in your DDS. These fields
are handled as variables in the procedure or program. When processing a DCLF
command, the CL compiler declares CL variables for each field and option indicator
in each record format in the file. For a field, the CL variable name is the
field name preceded by an ampersand (&amp;). For an option indicator, the
CL variable name is the indicator that is preceded by &amp;IN.</p>
<p>You use
the open file identifier (OPNID) parameter to uniquely identify an instance
of a declared file so that multiple files can be declared. If you use the
OPNID parameter, then for a field, the CL variable name is the field name
preceded by an ampersand (&amp;), the OPNID value, and an underscore (_).
For an option indicator, the CL variable name is the indicator preceded by
an ampersand (&amp;), the OPNID value, an underscore, and <span class="q">"IN"</span>.</p>
<p>For
example, if a field named INPUT and indicator 10 are defined in DDS,
the DCLF command automatically declares them as &amp;INPUT and &amp;IN10.
This declaration is performed when the CL module or program is compiled. Up
to 50 record format names can be specified on one command, but none can be
variables. Only one record format may be specified for a database file.</p>
<p>If
the following DDS were used to create display file CNTRLDSP in library MCGANN:</p>
<div class="fignone"><pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A R MASTER
A CA01(01 'F1 RESPONSE')
A TEXT 300 2 4
A RESPONSE 15 1 8 4 BLINK
A
A</pre>
</div>
<div class="p">Three variables, &amp;IN01, &amp;TEXT, and &amp;RESPONSE, would be
available from the display file. In a CL procedure referring to this display
file, you would enter only the DCLF source statement: <pre> DCLF MCGANN/CNTRLDSP</pre>
</div>
<p>The compiler will expand this statement to individually
declare all display file variables. The expanded declaration in the compiler
list looks like this:</p>
<div class="fignone"><pre>
00500- DCLF(MCGANN/CNTRLDSP)
04/02/03
QUALIFIED FILE NAME - MCGANN/CNTRLDSP
RECORD FORMAT NAME - MASTER
CL VARIABLE TYPE LENGTH PRECISION (IF *DEC)
&amp;IN01 *LGL 1
&amp;TEXT *CHAR 300
&amp;RESPONSE *CHAR 15
</pre>
</div>
<p>If the DCLF source statement includes an OPNID parameter:</p>
<pre>DCLF MCGANN/CNTRLDSP OPNID(OPENID1)</pre>
<p>The expanded declaration in the compiler list will look like
this:</p>
<pre>
00500- DCLF FILE(MCGANN/CNTRLDSP) OPNID(OPENID1) 04/02/03
QUALIFIED FILE NAME - MCGANN/CNTRLDSP
RECORD FORMAT NAME - MASTER
CL VARIABLE TYPE LENGTH PRECISION TEXT
&amp;OPENID1_IN01 *LGL 1
&amp;OPENID1_TEXT *CHAR 300
&amp;OPENID1_RESPONSE *CHAR 15
</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="wfile.htm" title="Two types of files are supported in CL procedures and programs: display files and database files.">Work with files in CL procedures</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../cl/dclf.htm">Declare File (DCLF) command</a></div>
</div>
</div>
</body>
</html>