ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzakb_5.4.0.1/rzakbmstlgjoin.htm

177 lines
9.8 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="JOIN (Join) keyword—join logical files only" />
<meta name="abstract" content="Use this join-level keyword to identify which pair of files are joined by the join specification in which you specify this keyword." />
<meta name="description" content="Use this join-level keyword to identify which pair of files are joined by the join specification in which you specify this keyword." />
<meta name="DC.subject" content="JOIN (Join) keyword" />
<meta name="keywords" content="JOIN (Join) keyword" />
<meta name="DC.Relation" scheme="URI" content="rzakbmstlfkeyw.htm" />
<meta name="DC.Relation" scheme="URI" content="lftype.htm" />
<meta name="DC.Relation" scheme="URI" content="rzakbmstljfile.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 2001, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2001, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="lgjoin" />
<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>Physical and Logical Files, JOIN</title>
</head>
<body id="lgjoin"><a name="lgjoin"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">JOIN (Join) keyword—join logical files only</h1>
<div><p>Use this join-level keyword to identify which pair of files are
joined by the join specification in which you specify this keyword.</p>
<div class="section"><div class="p">The format of the keyword is: <pre>JOIN(from-file to-file)</pre>
</div>
<p>This
keyword is valid only for join logical files.</p>
<p>You can use file names
or relative file numbers to indicate which files are to be joined. You must
specify a relative file number if the same file is specified more than once
on the JFILE keyword.</p>
<p>If you specify file names, you must select files
that you have specified only once on the JFILE keyword. On each JFILE keyword,
the <em>from</em> file must occur before the <em>to</em> file.</p>
<div class="p">If you specify
numbers, they correspond to the files specified on the JFILE keyword. The
following values are valid: <dl><dt><strong>File</strong></dt>
<dd><strong>Valid values</strong></dd>
<dt class="dlterm">From-file number</dt>
<dd>1 through 255</dd>
<dt class="dlterm">To-file number</dt>
<dd>2 through 256</dd>
</dl>
</div>
<p>The <em>from-file</em> number must always be less than
the <em>to-file</em> number.</p>
<p>Special rules apply to the order in which
you specify <em>from</em> and <em>to</em> files. See example 3 in this topic for
details.</p>
<p>In a join logical file, each secondary file can be a <em>to</em> file
only once.</p>
</div>
<div class="section"><h4 class="sectiontitle">Join specifications for physical and logical files</h4><div class="p">To describe a join specification, follow the instructions:
<ol><li>Specify J in position 17 immediately after the record level (before the
first field name in positions 19 through 28). J in position 17 indicates
the beginning of a join specification.</li>
<li>Specify the JOIN keyword. The JOIN keyword is optional when only two
files are specified on the JFILE keyword. When more than two physical files
are specified on the JFILE keyword, one JOIN keyword is required for each
secondary file.</li>
<li>Specify the JFLD keyword at least once for each join specification.</li>
<li>The end of the join specification is indicated by another J in position
17 or by a field name specified in positions 19 through 28.</li>
</ol>
</div>
<p>There must be one join specification for each secondary file specified
on the JFILE keyword. Therefore, at least one join specification is required
in a join logical file.</p>
<p>You can specify the JOIN keyword only once within
a join specification.</p>
</div>
<div class="section"><h4 class="sectiontitle">Examples</h4><p>The following examples show how to specify
the JOIN keyword.</p>
</div>
<div class="example"><h4 class="sectiontitle">Example 1</h4><pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A R RECORD1 JFILE(PFA PFB PFC)
00020A J JOIN(PFA PFB)
00030A JFLD(NAME1 NAME2)
00040A J JOIN(PFA PFC)
00050A JFLD(NAME1 NAME3)
00060A NAME1
A</pre>
<p>In this example, PFA is joined to PFB and also to PFC.</p>
</div>
<div class="example"><h4 class="sectiontitle">Example 2</h4><p>The following example shows how to specify
JOIN using relative file numbers.</p>
<pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A R RECORD1 JFILE(PFA PFB PFC)
00020A J JOIN(1 2)
00030A JFLD(NAME1 NAME2)
00040A J JOIN(1 3)
00050A JFLD(NAME1 NAME3)
00060A NAME1
A</pre>
<p>Example 2 is equivalent to example
1. PFA is the first physical file specified on the JFILE keyword and has relative
file number 1. PFB and PFC are the second and third files specified on the
JFILE keyword. PFB has relative file number 2, and PFC relative file number
3.</p>
</div>
<div class="example"><h4 class="sectiontitle">Example 3</h4><p>The following example shows the order
of associated physical files.</p>
<pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A R J3 JFILE(VENDORS PARTS PARTWARE +
00020A WAREHOUSE
<span><span>1</span></span>
00030A J JOIN(<strong>1</strong> <strong>2</strong>) <span><span>2</span></span>
00040A JFLD(VNBR VNUM)
00050A J JOIN(<strong>2</strong> <strong>3</strong>) <span><span>3</span></span>
00060A JFLD(PNBR PNBR)
00070A J JOIN(<strong>3</strong> <strong>4</strong>) <span><span>3</span></span>
00080A JFLD(WNBR WNBR)
00090A VNAME
00100A VAD1
00110A VAD2
00120A PNBR JREF(2)
00130A WNBR JREF(4)
00140A BIN
00150A QOH
A</pre>
<p>The join logical file in this example
is based on four physical files. The VENDORS file, which is specified first
on the JFILE keyword, is the primary file and has relative file number 1.
The PARTS, PARTWARE, and WAREHOUSE files are secondary files. PARTS has relative
file number 2, PARTWARE relative file number 3, and WAREHOUSE relative file
number 4.</p>
<div class="p">Notice the pattern of numbers specified on the JOIN keywords:
<dl><dt class="dlterm"><span>1</span></dt>
<dd>The first parameter value on the first JOIN keyword (the first <em>from</em> file)
must be the primary file.</dd>
<dt class="dlterm"><span>2</span></dt>
<dd>The second parameter values specified on the JOIN keywords
(<em>to</em> files) must reflect the same order as the secondary files on the
JFILE keyword. If file names are specified instead of relative file numbers,
they should be specified in the following order: <pre>J JOIN(VENDORS PARTS)
J JOIN(PARTS PARTWARE)
J JOIN(PARTWARE WAREHOUSE)</pre>
</dd>
<dt class="dlterm"><span>3</span></dt>
<dd>On each JOIN keyword, the <em>from</em> and <em>to</em> files must be specified
in ascending order.</dd>
</dl>
<div class="note"><span class="notetitle">Note:</span> A file can be specified as a <em>from</em> file more than
once. For example, the parameters on the JOIN keywords before might
be specified as follows: <pre>J JOIN(1 2)
J JOIN(2 3)
J JOIN(2 4)</pre>
</div>
</div>
<p>However, a file can be specified as
a <em>to</em> file only once.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzakbmstlfkeyw.htm" title="This topic lists valid keyword entries for describing physical and logical files. They are typed in positions 45 through 80 (functions).">Keyword entries for physical and logical files (positions 45 through 80)</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="lftype.htm" title="Type a value in this position to identify the type of name or, for logical files, the type of specification. If you specify a name type, the name is specified in positions 19 through 28.">Type of name or specification for physical and logical files (position 17)</a></div>
<div><a href="rzakbmstljfile.htm" title="Use this record-level keyword to identify the physical files containing the data to be accessed through the join logical file you are defining.">JFILE (Joined Files) keyword—join logical files only</a></div>
</div>
</div>
</body>
</html>