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

111 lines
6.6 KiB
HTML
Raw 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="reference" />
<meta name="DC.Title" content="Use join fields whose attributes are different (example 4)" />
<meta name="abstract" content="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." />
<meta name="description" content="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." />
<meta name="DC.subject" content="example, using, join fields whose attributes are different" />
<meta name="keywords" content="example, using, join fields whose attributes are different" />
<meta name="DC.Relation" scheme="URI" content="rbafojnlof.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="rbafomisjf" />
<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 join fields whose attributes are different (example 4)</title>
</head>
<body id="rbafomisjf"><a name="rbafomisjf"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1"> Use join fields whose attributes are different (example 4)</h1>
<div><p>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.</p>
<div class="section"><p>For example, as in <a href="rbafoduprc.htm#rbafoduprc">Read duplicate records in secondary files (example 3)</a>,
the <em>Name1</em> field is a character field 10 characters long in physical
file PF1, and can be joined to the <em>Name2</em> field, a character field 10
characters long in physical file PF2. The <em>Name1</em> and <em>Name2</em> fields
have the same characteristics and, therefore, can easily be used as join fields.</p>
</div>
<div class="section"><p>You can also use character type fields that have different lengths
as join fields without requiring any redefinition of the fields. For example,
if the NAME1 field of PF1 is 10 characters long and the NAME2 field of PF2
is 15 characters long, those fields can be used as join fields without redefining
one of the fields.</p>
</div>
<div class="section"><p>The following example shows the join fields that do not have the
same attributes. Both physical files have fields for employee number. The <em>Nbr</em> field
in physical file PF1 and the <em>Nbr</em> field in physical file PF2 both have
a length of 3 specified in position 34, but in the PF1 file the field is zoned
(S in position 35), and in the PF2 file the field is packed (P in position
35). To join the two files using these fields as join fields, you must redefine
one or both fields to have the same attributes.</p>
</div>
<div class="section"><p>The following example illustrates the fields in the logical and
physical files:</p>
</div>
<div class="section"><br /><img src="rbafo527.gif" alt="Examples of records" /><br /></div>
<div class="section"><p>The join logical file (JLF) contains <em>Employee number</em>, <em>Name</em>,
and <em>Salary</em> fields. Physical file 1 (PF1) contains <em>Employee number</em> (zoned)
and <em>Name</em>. Physical file 2 (PF2) contains <em>Employee number</em> (packed)
and <em>Salary</em>. The data description specifications (DDS) for these files
are shown as follows:</p>
</div>
<div class="example"> <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 S JREF(2)
A NAME
A SALARY
A
<strong>PF1</strong>
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A R REC1
A NBR 3S 0 <strong>&lt;-Zoned</strong>
A NAME 20
A K NBR
A
<strong>PF2</strong>
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A R REC2
A NBR 3P 0 <strong>&lt;-Packed</strong>
A SALARY 7 2
A K NBR
A</pre>
</div>
<div class="section"> <div class="note"><span class="notetitle">Note:</span> In this example, the <em>Nbr</em> field in the logical file
comes from PF2, because JREF(2) is specified. Instead of specifying the physical
file name, you can specify a relative file number on the JREF keyword; in
this example, the 2 indicates PF2.</div>
</div>
<div class="section"><p>Because the <em>Nbr</em> fields in the PF1 and PF2 files are used
as the join fields, they must have the same attributes. In this example, they
do not. Therefore, you must redefine one or both of them to have the same
attributes. In this example, to resolve the difference in the attributes of
the two employee number fields, the <em>Nbr</em> field in JLF (which is coming
from the PF2 file) is redefined as zoned (S in position 35 of JLF).</p>
</div>
</div>
<div>
<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>
</body>
</html>