212 lines
13 KiB
HTML
212 lines
13 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="Basic concepts of joining two physical files (example 1)" />
|
||
|
<meta name="abstract" content="A join logical file is a logical file that combines (in one record format) fields from two or more physical files because in the record format not all the fields need to exist in all the physical files." />
|
||
|
<meta name="description" content="A join logical file is a logical file that combines (in one record format) fields from two or more physical files because in the record format not all the fields need to exist in all the physical files." />
|
||
|
<meta name="DC.subject" content="joining, two physical files, example, physical file, two, example, example, two physical files, logical file, join, defined, join logical file, definition" />
|
||
|
<meta name="keywords" content="joining, two physical files, example, physical file, two, example, example, two physical files, logical file, join, defined, join logical file, definition" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafojnlof.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafordjlf.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafocas1m.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafocas2a.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafocas2b.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafocas3s.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafocase4.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafocase5.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="../dds/kickoff.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafoj3mpf.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafomisjf.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="rbafox2phyf" />
|
||
|
<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>Basic concepts of joining two physical files (example 1)</title>
|
||
|
</head>
|
||
|
<body id="rbafox2phyf"><a name="rbafox2phyf"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Basic concepts of joining two physical files (example 1)</h1>
|
||
|
<div><p>A <em>join logical file</em> is a logical file that combines (in
|
||
|
one record format) fields from two or more physical files because in the record
|
||
|
format not all the fields need to exist in all the physical files.</p>
|
||
|
<p>The following example illustrates a join logical file that joins two physical
|
||
|
files. This example is used for the five cases discussed in example 1.</p>
|
||
|
<br /><img src="rbafo507.gif" alt="Examples of join files" /><br /><p>In this example, the join logical file (JLF) has field <em>Employee number</em>, <em>Name</em>,
|
||
|
and <em>Salary</em>. Physical file 1 (PF1) has <em>Employee number</em> and <em>Name</em>,
|
||
|
while physical file 2 (PF2) has <em>Employee number</em> and <em>Salary</em>. <em>Employee
|
||
|
number</em> is common to both physical files (PF1 and PF2), but <em>Name</em> is
|
||
|
found only in PF1, and <em>Salary</em> is found only in PF2.</p>
|
||
|
<p>With a join logical file, the application program does one read operation
|
||
|
(to the record format in the join logical file) and gets all the data needed
|
||
|
from both physical files. Without the join specification, the logical file
|
||
|
would contain two record formats, one based on PF1 and the other based on
|
||
|
PF2, and the application program would have to do two read operations to get
|
||
|
all the needed data from the two physical files. Thus, join provides more
|
||
|
flexibility in designing your database.</p>
|
||
|
<div class="p">However, a few restrictions are placed on join logical files: <ul><li>You cannot change a physical file through a join logical file. To do update,
|
||
|
delete, or write (add) operations, you must create a second multiple format
|
||
|
logical file and use it to change the physical files. You can also use the
|
||
|
physical files, directly, to do the change operations.</li>
|
||
|
<li>You cannot use data file utility (DFU) to display a join logical file.</li>
|
||
|
<li>You can specify only one record format in a join logical file.</li>
|
||
|
<li>The record format in a join logical file cannot be shared.</li>
|
||
|
<li>A join logical file cannot share the record format of another file.</li>
|
||
|
<li>Key fields must be fields defined in the join record format and must be
|
||
|
fields from the first file specified on the JFILE keyword (which is called
|
||
|
the primary file).</li>
|
||
|
<li>Select/omit fields must be fields defined in the join record format, but
|
||
|
can come from any of the physical files.</li>
|
||
|
<li>Commitment control cannot be used with join logical files.</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<p>The following example shows the data description specifications (DDS) for
|
||
|
example 1:</p>
|
||
|
<pre><strong>JLF</strong>
|
||
|
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
|
||
|
A R JOINREC JFILE(PF1 PF2)
|
||
|
A J JOIN(PF1 PF2)
|
||
|
A JFLD(NBR NBR)
|
||
|
A NBR JREF(PF1)
|
||
|
A NAME
|
||
|
A SALARY
|
||
|
A K NBR
|
||
|
A
|
||
|
|
||
|
<strong>PF1</strong>
|
||
|
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
|
||
|
A R REC1
|
||
|
A NBR 10
|
||
|
A NAME 20
|
||
|
A K NBR
|
||
|
A
|
||
|
|
||
|
<strong>PF2</strong>
|
||
|
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
|
||
|
A R REC2
|
||
|
A NBR 10
|
||
|
A SALARY 7 2
|
||
|
A K NBR
|
||
|
A</pre>
|
||
|
<p>The following list describes the DDS for the join logical file in example
|
||
|
1:</p>
|
||
|
<div class="p">The record-level specification identifies the record format
|
||
|
name used in the join logical file. <dl><dt class="dlterm">R</dt>
|
||
|
<dd>Identifies the record format. Only one record format can be placed in
|
||
|
a join logical file.</dd>
|
||
|
<dt class="dlterm">JFILE</dt>
|
||
|
<dd>Replaces the PFILE keyword
|
||
|
used in simple and multiple-format logical files. You must specify at least
|
||
|
two physical files. The first file specified on the JFILE keyword is the primary
|
||
|
file. The other files specified on the JFILE keyword are secondary files.</dd>
|
||
|
</dl>
|
||
|
</div>
|
||
|
<div class="p">The join specification describes the way a pair of physical files is joined.
|
||
|
The second file of the pair is always a secondary file, and there must be
|
||
|
one join specification for each secondary file. <dl><dt class="dlterm">J</dt>
|
||
|
<dd>Identifies the start of a join specification. You must specify at least
|
||
|
one join specification in a join logical file. A join specification ends at
|
||
|
the first field name specified in positions 19 through 28 or at the next J
|
||
|
specified in position 17.</dd>
|
||
|
<dt class="dlterm">JOIN</dt>
|
||
|
<dd>Identifies which two files are joined by the join specification. If only
|
||
|
two physical files are joined by the join logical file, the JOIN keyword is
|
||
|
optional. </dd>
|
||
|
<dt class="dlterm">JFLD</dt>
|
||
|
<dd>Identifies
|
||
|
the join fields that join records from the physical files specified on the
|
||
|
JOIN keyword. JFLD must be specified at least once for each join specification.
|
||
|
The join fields are fields common to the physical files. The first join field
|
||
|
is a field from the first file specified on the JOIN keyword, and the second
|
||
|
join field is a field from the second file specified on the JOIN keyword. <p>Join
|
||
|
fields, except character type fields, must have the same attributes (data
|
||
|
type, length, and decimal positions). If the fields are character type fields,
|
||
|
they do not need to have the same length. If you are joining physical file
|
||
|
fields that do not have the same attributes, you can redefine them for use
|
||
|
in a join logical file. </p>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
</div>
|
||
|
<div class="p">The field-level specification identifies the fields included in the join
|
||
|
logical file. <dl><dt class="dlterm">Field names</dt>
|
||
|
<dd>Specifies which fields (in this example, <em>Nbr</em>, <em>Name</em>, and <em>Salary</em>)
|
||
|
are used by the application program. At least one field name is required.
|
||
|
You can specify any field names from the physical files used by the logical
|
||
|
file. You can also use keywords like RENAME, CONCAT, or SST as you would in
|
||
|
simple and multiple format logical files.</dd>
|
||
|
<dt class="dlterm">JREF</dt>
|
||
|
<dd>In the record format (which follows the join specification level and precedes
|
||
|
the key field level, if any), the field names must uniquely identify which
|
||
|
physical file the field comes from. In this example, the <em>Nbr</em> field
|
||
|
occurs in both PF1 and PF2. Therefore, the JREF keyword is required to identify
|
||
|
the file from which the <em>Nbr</em> field description will be used.</dd>
|
||
|
</dl>
|
||
|
</div>
|
||
|
<div class="p">The key field level specification is optional, and includes the key field
|
||
|
names for the join logical file. <dl><dt class="dlterm">K</dt>
|
||
|
<dd>Identifies a key field specification. The K appears in position 17. Key
|
||
|
field specifications are optional.</dd>
|
||
|
<dt class="dlterm">Key field names</dt>
|
||
|
<dd>Key field names (in this example, <em>Nbr</em> is the only key field) are
|
||
|
optional and make the join logical file an indexed (keyed sequence) file.
|
||
|
Without key fields, the join logical file is an arrival sequence file. In
|
||
|
join logical files, key fields must be fields from the primary file, and the
|
||
|
key field name must be specified in positions 19 through 28 in the logical
|
||
|
file record format.</dd>
|
||
|
</dl>
|
||
|
</div>
|
||
|
<div class="p">The select/omit field level specification is optional, and includes select/omit
|
||
|
field names for the join logical file. <dl><dt class="dlterm">S or O</dt>
|
||
|
<dd>Identifies a select or omit specification. The S or O appears in position
|
||
|
17. Select/omit specifications are optional.</dd>
|
||
|
<dt class="dlterm">Select/omit field names</dt>
|
||
|
<dd>Only those records meeting the select/omit values will be returned to
|
||
|
the program using the logical file. Select/omit fields must be specified in
|
||
|
positions 19 through 28 in the logical file record format.</dd>
|
||
|
</dl>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<ul class="ullinks">
|
||
|
<li class="ulchildlink"><strong><a href="rbafordjlf.htm">Read a join logical file</a></strong><br />
|
||
|
</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafocas1m.htm">Match records in primary and secondary files (case 1)</a></strong><br />
|
||
|
</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafocas2a.htm">Record missing in secondary file: JDFTVAL keyword not specified (case 2A)</a></strong><br />
|
||
|
</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafocas2b.htm">Record missing in secondary file: JDFTVAL keyword specified (case 2B)</a></strong><br />
|
||
|
</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafocas3s.htm">Secondary file has more than one match for a record in the primary file (case 3)</a></strong><br />
|
||
|
</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafocase4.htm">Extra record in secondary file (case 4)</a></strong><br />
|
||
|
</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafocase5.htm">Random access (case 5)</a></strong><br />
|
||
|
</li>
|
||
|
</ul>
|
||
|
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafojnlof.htm" title="These topics provide examples to illustrate how to set up a join logical file. Performance, integrity, and a summary of rules for join logical files are also included.">Set up a join logical file</a></div>
|
||
|
</div>
|
||
|
<div class="relconcepts"><strong>Related concepts</strong><br />
|
||
|
<div><a href="../dds/kickoff.htm">DDS concepts</a></div>
|
||
|
</div>
|
||
|
<div class="relref"><strong>Related reference</strong><br />
|
||
|
<div><a href="rbafoj3mpf.htm" title="You can use a join logical file to join as many as 32 physical files. These files must be specified on the JFILE keyword. The first file specified on the JFILE keyword is the primary file; the other files are all secondary files.">Join three or more physical files (example 7)</a></div>
|
||
|
<div><a href="rbafomisjf.htm" title="Fields from physical files that you use as join fields generally have the same attributes (length, data type, and decimal positions). However, in some cases, the join fields might have different attributes.">Use join fields whose attributes are different (example 4)</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|