106 lines
7.1 KiB
HTML
106 lines
7.1 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="Use a file with a different record format" />
|
|
<meta name="abstract" content="For more advanced functions of the Open Query File (OPNQRYF) command (such as dynamically joining records from different files), you must define a new file that contains a different record format." />
|
|
<meta name="description" content="For more advanced functions of the Open Query File (OPNQRYF) command (such as dynamically joining records from different files), you must define a new file that contains a different record format." />
|
|
<meta name="DC.Relation" scheme="URI" content="rbafoopnqf.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="rbafoufdrf.dita" />
|
|
<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 a file with a different record format</title>
|
|
</head>
|
|
<body id="rbafoufdrf.dita"><a name="rbafoufdrf.dita"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Use a file with a different record format</h1>
|
|
<div><p>For more advanced functions of the Open Query File (OPNQRYF) command
|
|
(such as dynamically joining records from different files), you must define
|
|
a new file that contains a different record format.</p>
|
|
<p>This new file is separate from the one you are going to process and contains
|
|
the fields that you want to create with the OPNQRYF command. This powerful
|
|
capability also lets you define fields that do not currently exist in your
|
|
database records, but can be derived from them.</p>
|
|
<p>When you code your high-level language program, specify the name of the
|
|
file with the different format so the externally described field definitions
|
|
of both existing and derived fields can be processed by the program.</p>
|
|
<p>Before calling your high-level language program, you must specify an Override
|
|
with Database File (OVRDBF) command to direct your program file name to the
|
|
open query file. On the OPNQRYF command, specify both the database file and
|
|
the new file with the special format to be used by your high-level language
|
|
program. If the file you are querying does not have SHARE(*YES) specified,
|
|
you must specify SHARE(*YES) on the OVRDBF command.</p>
|
|
<p>The following chart shows the process flow:</p>
|
|
<br /><img src="rbafo539.gif" alt="Use a file with a different record format" /><br /><dl><dt class="dlterm"><strong>1</strong></dt>
|
|
<dd>Specify the data description specifications (DDS) for the file with the
|
|
different record format, and create the file. This file contains the fields
|
|
that you want to process with your high-level language program. Normally,
|
|
data is not contained in this file, and it does not require a member. You
|
|
normally create this file as a physical file without keys. A field reference
|
|
file can be used to describe the fields. The record format name can be different
|
|
from the record format name in the database file that is specified. You can
|
|
use any database or DDM file for this function. The file can be a logical
|
|
file and it can be indexed. It can have one or more members, with or without
|
|
data.</dd>
|
|
<dt class="dlterm"><strong>2</strong></dt>
|
|
<dd>Create the high-level language program to process the file with the record
|
|
format that you created in step 1. In this program, do not name the database
|
|
file that contains the data.</dd>
|
|
<dt class="dlterm"><strong>3</strong></dt>
|
|
<dd>Run the OVRDBF command. Specify the name of the file with the different
|
|
(new) record format on the FILE parameter. Specify the name of the database
|
|
file that you want to query on the TOFILE parameter. You can also specify
|
|
a member name on the MBR parameter. If the database member you are querying
|
|
does not have SHARE(*YES) specified, you must also specify SHARE(*YES) on
|
|
the OVRDBF command.</dd>
|
|
<dt class="dlterm"><strong>4</strong></dt>
|
|
<dd>Run the OPNQRYF command. Specify the database file to be
|
|
queried on the FILE parameter, and specify the name of the file with the different
|
|
(new) format that was created in step 1 on the FORMAT parameter. Mapped field
|
|
definitions can be required on the OPNQRYF command to describe how to map
|
|
the data from the database file into the format that was created in step 1.
|
|
You can also specify selection options, sequencing options, and the scope
|
|
of influence for the opened file.</dd>
|
|
<dt class="dlterm"><strong>5</strong></dt>
|
|
<dd>Call the high-level language program you created in step 2.</dd>
|
|
<dt class="dlterm"><strong>6</strong></dt>
|
|
<dd>The first file named in step 4 for the FILE parameter was opened with
|
|
OPNQRYF as SHARE(*YES) and is still open. The file must be closed. The Close
|
|
File (CLOF) command can be used.</dd>
|
|
<dt class="dlterm"><strong>7</strong></dt>
|
|
<dd>Delete the override that was specified in step 3.</dd>
|
|
</dl>
|
|
<p>The previous steps show the normal flow using externally described data.
|
|
It is not necessary to create unique DDS and record formats for each OPNQRYF
|
|
command. You can reuse an existing record format. However, all fields in the
|
|
record format must be actual fields in the real database file or defined by
|
|
mapped field definitions. If you use program-described data, you can create
|
|
the program at any time.</p>
|
|
<p>You can use the file created in step 1 to hold the data created by the
|
|
OPNQRYF command. For example, you can replace step 5 with a high-level language
|
|
processing program that copies data to the file with the different format,
|
|
or you can use the Copy from Query File (CPYFRMQRYF) command. The Copy File
|
|
(CPYF) command cannot be used. You can then follow step 5 with the CPYF command
|
|
or Query.</p>
|
|
</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>
|
|
</body>
|
|
</html> |