141 lines
8.6 KiB
HTML
141 lines
8.6 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="Create a logical file with more than one record format" />
|
||
|
<meta name="abstract" content="A multiple format logical file lets you use related records from two or more physical files by referring to only one logical file. Each record format is always associated with one or more physical files. You can use the same physical file in more than one record format." />
|
||
|
<meta name="description" content="A multiple format logical file lets you use related records from two or more physical files by referring to only one logical file. Each record format is always associated with one or more physical files. You can use the same physical file in more than one record format." />
|
||
|
<meta name="DC.subject" content="logical file, creating, with more than one record format, record format, creating a logical file with more than one, multiple format logical file" />
|
||
|
<meta name="keywords" content="logical file, creating, with more than one record format, record format, creating a logical file with more than one, multiple format logical file" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafocrlof.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafononef.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafofmtsltu.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="rbafocrlff" />
|
||
|
<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>Create a logical file with more than one record format</title>
|
||
|
</head>
|
||
|
<body id="rbafocrlff"><a name="rbafocrlff"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Create a logical file with more than one record format</h1>
|
||
|
<div><p>A multiple format logical file lets you use related records from
|
||
|
two or more physical files by referring to only one logical file. Each record
|
||
|
format is always associated with one or more physical files. You can use the
|
||
|
same physical file in more than one record format. </p>
|
||
|
<p>The following example shows the data description specifications (DDS) for
|
||
|
a physical file, ORDDTLP, built from a field reference file:</p>
|
||
|
<pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
|
||
|
A* ORDER DETAIL FILE (ORDDTLP) - PHYSICAL FILE RECORD DEFINITION
|
||
|
A REF(DSTREF)
|
||
|
A R ORDDTL TEXT('Order detail record')
|
||
|
A CUST R
|
||
|
A ORDER R
|
||
|
A LINE R
|
||
|
A ITEM R
|
||
|
A QTYORD R
|
||
|
A DESCRP R
|
||
|
A PRICE R
|
||
|
A EXTENS R
|
||
|
A WHSLOC R
|
||
|
A ORDATE R
|
||
|
A CUTYPE R
|
||
|
A STATE R
|
||
|
A ACTMTH R
|
||
|
A ACTYR R
|
||
|
A</pre>
|
||
|
<p>The following example shows the DDS for the physical file ORDHDRP:</p>
|
||
|
<pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
|
||
|
A* ORDER HEADER FILE (ORDHDRP) - PHYSICAL FILE RECORD DEFINITION
|
||
|
A REF(DSTREFP)
|
||
|
A R ORDHDR TEXT('Order header record')
|
||
|
A CUST R
|
||
|
A ORDER R
|
||
|
A ORDATE R
|
||
|
A CUSORD R
|
||
|
A SHPVIA R
|
||
|
A ORDSTS R
|
||
|
A OPRNME R
|
||
|
A ORDMNT R
|
||
|
A CUTYPE R
|
||
|
A INVNBR R
|
||
|
A PRTDAT R
|
||
|
A SEQNBR R
|
||
|
A OPNSTS R
|
||
|
A LINES R
|
||
|
A ACTMTH R
|
||
|
A ACTYR R
|
||
|
A STATE R
|
||
|
A</pre>
|
||
|
<p>The following example shows how to create a logical file ORDFILL with two
|
||
|
record formats. One record format is defined for order header records from
|
||
|
the physical file ORDHDRP; the other is defined for order detail records from
|
||
|
the physical file ORDDTLP. </p>
|
||
|
<p>The logical file record format ORDHDR uses one key field, <em>Order</em>,
|
||
|
for sequencing; the logical file record format ORDDTL uses two keys fields, <em>Order</em> and <em>Line</em>,
|
||
|
for sequencing.</p>
|
||
|
<p>The following example shows the DDS for the logical file ORDFILL.</p>
|
||
|
<pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
|
||
|
A* ORDER TRANSACTION LOGICAL FILE (ORDFILL)
|
||
|
A R ORDHDR PFILE(ORDHDRP)
|
||
|
A K ORDER
|
||
|
A
|
||
|
A R ORDDTL PFILE(ORDDTLP)
|
||
|
A K ORDER
|
||
|
A K LINE
|
||
|
A</pre>
|
||
|
<div class="p">To create the logical file ORDFILL with two associated physical files,
|
||
|
use a Create Logical File (CRTLF) command in the following way: <pre>CRTLF FILE(DSTPRODLB/ORDFILL)
|
||
|
TEXT('Order transaction logical file')</pre>
|
||
|
</div>
|
||
|
<div class="p">The DDS source is in the member ORDFILL in the file QDDSSRC. The file ORDFILL
|
||
|
with a member of the same name is placed in the DSTPRODLB library. The access
|
||
|
path for the logical file member ORDFILL arranges records from both the ORDHDRP
|
||
|
and ORDDTLP files. Record formats for both physical files are keyed on <em>Order</em> as
|
||
|
the common field. Because of the order in which they were specified in the
|
||
|
logical file description, they are merged in <em>Order</em> sequence with duplicates
|
||
|
between files retrieved first from the header file ORDHDRP and second from
|
||
|
the detail file ORDDTLP. Because FIFO, LIFO, or FCFO are not specified, the
|
||
|
order of retrieval of duplicate keys in the same file is not guaranteed. <div class="note"><span class="notetitle">Note:</span> In some
|
||
|
circumstances, it is better to use multiple logical files, rather
|
||
|
than to use a multiple-format logical file. For example, when keyed access
|
||
|
is used with a multiple-format logical file, it is possible to experience
|
||
|
poor performance if one of the files has very few records. Even though there
|
||
|
are multiple formats, the logical file has only one index, with entries from
|
||
|
each physical file. Depending on the kind of processing being done by the
|
||
|
application program (for example, using RPG SETLL and READE with a key to
|
||
|
process the small file), the system might have to search all index entries
|
||
|
in order to find an entry from the small file. If the index has many entries,
|
||
|
searching the index might take a long time, depending on the number of keys
|
||
|
from each file and the sequence of keys in the index. (If the small file has
|
||
|
no records, performance is not affected, because the system can take a fast
|
||
|
path and avoid searching the index.)</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<ul class="ullinks">
|
||
|
<li class="ulchildlink"><strong><a href="rbafononef.htm">Control how records are retrieved in a file with multiple formats</a></strong><br />
|
||
|
In a logical file with more than one record format, key field definitions are required. Each record format has its own key definition, and the record format key fields can be defined to merge the records of the different formats. Each record format does not have to contain every key field in the key.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafofmtsltu.htm">Control how records are added to a file with multiple formats</a></strong><br />
|
||
|
To add a record to a multiple format logical file, you need to identify the member of the based-on physical file to which you want the record written.</li>
|
||
|
</ul>
|
||
|
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafocrlof.htm" title="This topic shows how to create a logical file using data description specifications (DDS).">Create a logical file</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|