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

190 lines
15 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="task" />
<meta name="DC.Title" content="Work with files in CL procedures" />
<meta name="abstract" content="Two types of files are supported in CL procedures and programs: display files and database files." />
<meta name="description" content="Two types of files are supported in CL procedures and programs: display files and database files." />
<meta name="DC.subject" content="CL procedure, working with file, file, working with, CL program, display formatting, control language (CL), program, files supported, control language (CL), sending, display file, SNDF (Send File) command, function, Send File (SNDF) command, command, CL, SNDF (Send File), command, CL, Send File (SNDF), data, data to display, RCVF (Receive File) command, Receive File (RCVF) command, RCVF (Receive File), Receive File (RCVF), receiving, database file, display file, SNDRCVF (Send/Receive File) command, Send/Receive File (SNDRCVF) command, SNDRCVF (Send/Receive File), Send/Receive File (SNDRCVF), display data, display file, using, using in CL program" />
<meta name="keywords" content="CL procedure, working with file, file, working with, CL program, display formatting, control language (CL), program, files supported, control language (CL), sending, display file, SNDF (Send File) command, function, Send File (SNDF) command, command, CL, SNDF (Send File), command, CL, Send File (SNDF), data, data to display, RCVF (Receive File) command, Receive File (RCVF) command, RCVF (Receive File), Receive File (RCVF), receiving, database file, display file, SNDRCVF (Send/Receive File) command, Send/Receive File (SNDRCVF) command, SNDRCVF (Send/Receive File), Send/Receive File (SNDRCVF), display data, display file, using, using in CL program" />
<meta name="DC.Relation" scheme="URI" content="objec.htm" />
<meta name="DC.Relation" scheme="URI" content="objdatacmds.htm" />
<meta name="DC.Relation" scheme="URI" content="reffi.htm" />
<meta name="DC.Relation" scheme="URI" content="ocfil.htm" />
<meta name="DC.Relation" scheme="URI" content="decla.htm" />
<meta name="DC.Relation" scheme="URI" content="srfil.htm" />
<meta name="DC.Relation" scheme="URI" content="cmenu.htm" />
<meta name="DC.Relation" scheme="URI" content="ovrdf.htm" />
<meta name="DC.Relation" scheme="URI" content="wmddf.htm" />
<meta name="DC.Relation" scheme="URI" content="rddbf.htm" />
<meta name="DC.Relation" scheme="URI" content="ovrbf.htm" />
<meta name="DC.Relation" scheme="URI" content="refof.htm" />
<meta name="DC.Relation" scheme="URI" content="parts.htm" />
<meta name="DC.Relation" scheme="URI" content="accessfile.htm" />
<meta name="DC.Relation" scheme="URI" content="../clfinder/finder.htm" />
<meta name="DC.Relation" scheme="URI" content="../rzahg/rzahgapdlprint.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="wfile" />
<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>Work with files in CL procedures</title>
</head>
<body id="wfile"><a name="wfile"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Work with files in CL procedures</h1>
<div><p>Two types of files are supported in CL procedures and programs:
display files and database files. </p>
<div class="section"> <p>You can send a display to a workstation and receive input from
the workstation for use in the procedure or program, or you can read data
from a database file for use in the procedure or program. </p>
<div class="note"><span class="notetitle">Note:</span> Database
files are made available for use within the CL procedure or program through
the DCLF and <span class="cmdname">Receive File (RCVF)</span> commands.</div>
<p>To
use a file in a CL procedure or program, you must: </p>
<ul><li>Format the display or database record, identifying fields and conditions
which you enter as DDS source. The use of DDS is not required for a database
file.</li>
<li>Create the file using the <span class="cmdname">Create Display File (CRTDSPF)</span> command, <span class="cmdname">Create
Physical File (CRTPF)</span> command, or <span class="cmdname">Create Logical File (CRTLF)</span> command.
Subfiles (except for message subfiles) are not supported by CL procedures
and programs.</li>
<li>For database files, add a member to the file using the <span class="cmdname">Add Physical
File Member (ADDPFM)</span> command or <pre>Add Logical File Member (ADDLFM)</pre>
command.
This is not required if a member was added by the CRTPF or CRTLF commands.
The file must have a member when the procedure or program is processed, but
does not need to have a member when the procedure or program is created.</li>
<li>Refer to the file in the CL procedure using the DCLF command, and refer
to the record format on the appropriate data manipulation CL commands in your
CL source.</li>
<li>Create the CL module.</li>
<li>Create the program or service program.</li>
</ul>
<p>Up to five display or database files can be referred to in a CL procedure.
The support for database files and display files is similar as the same commands
are used. However, there are a few differences, which are described here.
</p>
<ul><li>The following statements apply only to database files used with CL procedures
and programs: <ul><li>Only database files with a single record format may be used by a CL procedure
or program.</li>
<li>The files may be either physical or logical files, and a logical file
may be defined over multiple physical file members.</li>
<li>Only input operations, with the RCVF command, are allowed. The WAIT and
DEV parameters on the <span class="cmdname">Receive File (RCVF)</span> command are not
allowed for database files. In addition, the SNDF, SNDRCVF, and ENDRCV commands
are not allowed for database files.</li>
<li>DDS is not required to create a physical file which is referred to in
a CL procedure or program. If DDS is not used to create a physical file, the
file has a record format with the same name as the file, and there is one
field in the record format with the same name as the file, and with the same
length as the record length of the file (RCDLEN parameter of the CRTPF command).</li>
<li>The file need not have a member when it is created for the module or program.
It must, however, have a member when the file is processed by the program.</li>
<li>The file is opened for input only when the first <span class="cmdname">Receive File
(RCVF)</span> command is processed. The file must exist and have a member
at that time.</li>
<li>The file remains open until the procedure or OPM program returns or when
the end of file is reached. When end of file is reached, message CPF0864 is
sent to the CL procedure or program, and additional operations are not allowed
for the file. The procedure or program should monitor for this message and
take appropriate action when end of file is reached.</li>
</ul>
</li>
<li>The following statements apply only to display files used with CL procedures
and programs: <ul><li>Display files may have up to 99 record formats.</li>
<li>All data manipulation commands (SNDF, SNDRCVF, RCVF, ENDRCV and WAIT)
are allowed for display files.</li>
<li>The display file must be defined with the DDS.</li>
<li>The display file is opened for both input and output when the first SNDF,
SNDRCVF, or RCVF command is processed. The file remains open until the procedure
or OPM program returns.</li>
</ul>
</li>
</ul>
<div class="note"><span class="notetitle">Note:</span> The open does not occur for both types of files until the first
send or receive occurs. Because of this, the file to be used can be created
during the procedure or program and an override can be performed before the
first send or receive. However, the file must exist before the module or program
is compiled.</div>
<p>The format for the display is identified as a record
format in DDS. Each record format may contain fields (input, output, and
input/output), conditions/indicators, and constants. Several record formats
can be entered in one display file. The display file name, record format
name, and field names should be unique, because other HLLs may require it,
even though CL procedures and programs do not.</p>
<br /><img src="rbafn504.gif" alt="The format for the display is identified as a record format in DDS. Each record format may contain fields (input, output, and input/output), conditions/indicators, and constants. Several record formats can be entered in one display file. The display file name, record format name, and field names should be unique, because other HLLs may require it, even though CL procedures and programs do not." /><br /> </div>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="objdatacmds.htm">Data manipulation commands</a></strong><br />
A CL procedure or program can use several commands, called data manipulation commands.</li>
<li class="ulchildlink"><strong><a href="reffi.htm">Refer to files in a CL procedure</a></strong><br />
Files are accessed during compiling of <span class="cmdname">Declare File (DCLF)</span> commands
when CL modules and programs are created so that variables can be declared
for each field in the file.</li>
<li class="ulchildlink"><strong><a href="ocfil.htm">Open and close files in a CL procedure</a></strong><br />
When you use CL support, the file referred to is implicitly opened when you do your first send, receive, or send/receive operation. An opened display file remains open until the procedure or OPM program in which it was opened returns or transfers control. An opened database file is closed when end of file is reached, or when the procedure or OPM program in which it was opened returns or transfers control. Once a database file has been closed, it cannot be opened again during the same call of the procedure or OPM program.</li>
<li class="ulchildlink"><strong><a href="decla.htm">Declare a file</a></strong><br />
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.</li>
<li class="ulchildlink"><strong><a href="srfil.htm">Send and receive data with a display file</a></strong><br />
The only commands you can use with a display file to send or receive
data in CL procedures and programs are the <span class="cmdname">Send File (SNDF)</span>, <span class="cmdname">Receive
File (RCVF)</span>, and <span class="cmdname">Send/Receive File (SNDRCVF)</span> commands.</li>
<li class="ulchildlink"><strong><a href="cmenu.htm">Write a CL program to control a menu</a></strong><br />
This example shows how a CL procedure can be written to display and control a menu.</li>
<li class="ulchildlink"><strong><a href="ovrdf.htm">Override display files in a CL procedure</a></strong><br />
You can use the <span class="cmdname">Override with Display File (OVRDSPF)</span> command
to replace the display file named in a CL procedure or program or to change
certain parameters of the existing display file. This may be especially useful
for files that have been renamed or moved since the module or program was
compiled.</li>
<li class="ulchildlink"><strong><a href="wmddf.htm">Work with multiple device display files</a></strong><br />
The normal mode of operation on a system is for the workstation user to sign on and become the requester for an interactive job. Many users can do this at the same time, because each will use a logical copy of the procedure, including the display file in the procedure. Each requester calls a separate job in this kind of use. This is not considered to be multiple device display use.</li>
<li class="ulchildlink"><strong><a href="rddbf.htm">Receive data from a database file</a></strong><br />
The only command you can use to receive data from a database file
is the <span class="cmdname">Receive File (RCVF)</span> command.</li>
<li class="ulchildlink"><strong><a href="ovrbf.htm">Override database files in a CL procedure or program</a></strong><br />
You can use the <span class="cmdname">Override with Database File (OVRDBF)</span> command
to replace the database file named in a CL procedure or program or to change
certain parameters of the existing database file. This may be especially useful
for files that have been renamed or moved since the procedure or program was
created. It can also be used to access a file member other than the first
member.</li>
<li class="ulchildlink"><strong><a href="refof.htm">Refer to output files from display commands</a></strong><br />
A number of the IBM<sup>®</sup> display commands allow you to place the output from
the command into a database file (OUTFILE parameter). The data in this file
can be received directly into a CL procedure or program and processed.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="objec.htm" title="This provides tasks and concepts specific to objects and libraries, including functions performed on objects, creating libraries, and specifying object authority.">Objects and libraries</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="parts.htm" title="While each source statement entered as part of a CL procedure is actually a CL command, the source can be divided into the basic parts used in many typical CL procedures.">Parts of a CL procedure</a></div>
</div>
<div class="reltasks"><strong>Related tasks</strong><br />
<div><a href="accessfile.htm" title="A file must exist when compiling a CL module or OPM program that uses it.">Access files</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../clfinder/finder.htm">CL command finder</a></div>
<div><a href="../rzahg/rzahgapdlprint.htm">Application Display Programming</a></div>
</div>
</div>
</body>
</html>