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

84 lines
5.5 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<?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="Read a join logical file" />
<meta name="DC.subject" content="reading, join logical file" />
<meta name="keywords" content="reading, join logical file" />
<meta name="DC.Relation" scheme="URI" content="rbafox2phyf.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="rbafordjlf" />
<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>Read a join logical file</title>
</head>
<body id="rbafordjlf"><a name="rbafordjlf"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Read a join logical file</h1>
<div><p>The following cases describe how the join logical file in <a href="rbafox2phyf.htm#rbafox2phyf">Basic concepts of joining two physical files (example 1)</a> presents
records to an application programs.</p>
<p>The PF1 file is specified first on the JFILE keyword, and is therefore
the primary file. When the application program requests a record, the system
does the following things: </p>
<ol><li>Uses the value of the first join field in the primary file (the <em>Nbr</em> field
in PF1).</li>
<li>Finds the first record in the secondary file with a matching join field
(the <em>Nbr</em> field in PF2 matches the <em>Nbr</em> field in PF1).</li>
<li>For each match, joins the fields from the physical files into one record
and provides this record to your program. Depending on how many records are
in the physical files, one of the following conditions might occur: <ol type="a"><li>For all records in the primary file, only one matching record is found
in the secondary file. The resulting join logical file contains a single record
for each record in the primary file. See <a href="rbafocas1m.htm#rbafocas1m">Match records in primary and secondary files (case 1)</a>.</li>
<li>For some records in the primary file, no matching record is found in the
secondary file.</li>
</ol>
</li>
</ol>
<div class="p">If you specify the JDFTVAL keyword: <ul><li>For those records in the primary file that have a matching record in the
secondary file, the system joins to the secondary, or multiple secondaries.
The result is one or more records for each record in the primary file.</li>
<li>For those records in the primary file that do not have a matching record
in the secondary file, the system adds the default value fields for the secondary
file and continues the join operation. You can use the DFT keyword in the
physical file to define which defaults are used. See <a href="rbafocas2a.htm#rbafocas2a">Record missing in secondary file: JDFTVAL keyword not specified (case 2A)</a> and <a href="rbafocas2b.htm#rbafocas2b">Record missing in secondary file: JDFTVAL keyword specified (case 2B)</a>. <div class="note"><span class="notetitle">Note:</span> If the DFT keyword is specified
in the secondary file, the value specified for the DFT keyword is used in
the join. The result would be at least one join record for each primary record.</div>
</li>
<li>If a record exists in the secondary file, but the primary file has no
matching value, no record is returned to your program. A second join logical
file can be used that reverses the order of primary and secondary files to
determine if secondary file records exist with no matching primary file records.</li>
</ul>
</div>
<div class="p">If you do not specify the JDFTVAL keyword: <ul><li>If a matching record in a secondary file exists, the system joins to the
secondary, or multiple secondaries. The result is one or more records for
each record in the primary file.</li>
<li>If a matching record in a secondary file does not exist, the system does
not return a record.</li>
</ul>
</div>
<div class="note"><span class="notetitle">Note:</span> When the JDFTVAL is not specified, the system returns a record only
if a match is found in every secondary file for a record in the primary file.</div>
<p>In the following examples, cases 1 through 4 describe sequential read operations,
and case 5 describes reading by key.</p>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafox2phyf.htm" title="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.">Basic concepts of joining two physical files (example 1)</a></div>
</div>
</div>
</body>
</html>