ibm-information-center/dist/eclipse/plugins/i5OS.ic.dbp_5.4.0.1/rbafoufinf.htm

91 lines
6.4 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="Use an existing record format in the file" />
<meta name="abstract" content="The Open Query File (OPNQRYF) command does the record selection and your program processes only the records that meet the selection values. You can use this approach to select a set of records, return records in a different sequence than they are stored, or both." />
<meta name="description" content="The Open Query File (OPNQRYF) command does the record selection and your program processes only the records that meet the selection values. You can use this approach to select a set of records, return records in a different sequence than they are stored, or both." />
<meta name="DC.subject" content="record format, using, existing" />
<meta name="keywords" content="record format, using, existing" />
<meta name="DC.Relation" scheme="URI" content="rbafoopnqf.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafocosof.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="rbafoufinf" />
<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 an existing record format in the file</title>
</head>
<body id="rbafoufinf"><a name="rbafoufinf"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Use an existing record format in the file</h1>
<div><p>The Open Query File (OPNQRYF) command does the record selection
and your program processes only the records that meet the selection values.
You can use this approach to select a set of records, return records in a
different sequence than they are stored, or both. </p>
<div class="section"> <p>Assume that you only want your program to process the records
in which the <em>Code</em> field is equal to D. You create the program as if
there were only records with a D in the <em>Code</em> field. That is, you do
not code any selection operations in the program. You then run the OPNQRYF
command and specify that only the records with a D in the <em>Code</em> field
are to be returned to the program. The following chart is an example of using
the OPNQRYF command to select and sequence records:</p>
<br /><img src="rbafo538.gif" alt="Examples of records" /><br /><dl><dt class="dlterm"><strong>1</strong></dt>
<dd>Create the high-level language program to process the database file as
you would any normal program using externally described data. Only one format
can be used, and it must exist in the file.</dd>
<dt class="dlterm"><strong>2</strong></dt>
<dd>Run the Override with Database file (OVRDBF) command specifying the file
and member to be processed and SHARE(*YES). (If the member is permanently
changed to SHARE(*YES) and the first or only member is the one you want to
use, this step is not necessary.) <p>The OVRDBF command can be run after the
OPNQRYF command, unless you want to override the file name specified in the
OPNQRYF command. In this discussion and in these examples, the OVRDBF command
is shown first.</p>
<p>Some restrictions are placed on using the OVRDBF command
with the OPNQRYF command. For example, MBR(*ALL) causes an error message and
the file is not opened. </p>
</dd>
<dt class="dlterm"><strong>3</strong></dt>
<dd>Run the OPNQRYF command, specifying the database file, member, format
names, any selection options, any sequencing options, and the scope of influence
for the opened file.</dd>
<dt class="dlterm"><strong>4</strong></dt>
<dd>Call the high-level language program you created in step 1. Besides using
a high-level language, the Copy from Query File (CPYFRMQRYF) command can also
be used to process the file created by the OPNQRYF command. Other control
language (CL) commands (for example, the Copy File (CPYF) and
the Display Physical File Member (DSPPFM) commands) and utilities (for example,
Query) do not work on files created with the OPNQRYF command.</dd>
<dt class="dlterm"><strong>5</strong></dt>
<dd>Close the file that you opened in step 3, unless you want the file to
remain open. The Close File (CLOF) command can be used to close the file.</dd>
<dt class="dlterm"><strong>6</strong></dt>
<dd>Delete the override specified in step 2 with the Delete Override (DLTOVR)
command. It might not always be necessary to delete the override, but the
command is shown in all the examples for consistency.</dd>
</dl>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafoopnqf.htm" title="The Open Query File (OPNQRYF) command is a control language (CL) command that allows you to perform many data processing functions on database files. These topics discuss how to create a query using the OPNQRYF command, how to specify parameters for its major functions, and how to use it with your high-level language program.">Use Open Query File (OPNQRYF) command</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="rbafocosof.htm" title="In order for your application program to use the open data path built by the Open Query File (OPNQRYF) command, your program must share the query file. If your program does not open the query file as shared, then it actually does a full open of the file it was originally compiled to use (not the query open data path built by the OPNQRYF command).">Files shared in a job</a></div>
</div>
</div>
</body>
</html>