ibm-information-center/dist/eclipse/plugins/i5OS.ic.dm_5.4.0.1/rbal3recsq.htm

156 lines
10 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="copyright" content="(C) Copyright IBM Corporation 2005" />
<meta name="DC.rights.owner" content="(C) Copyright IBM Corporation 2005" />
<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="Record sequence and copying" />
<meta name="abstract" content="The access path is the sequence in which records are organized in a database file. There are two types of access paths: keyed sequence and arrival sequence. With the copy function, you can process records in a database file in either arrival sequence or keyed sequence." />
<meta name="description" content="The access path is the sequence in which records are organized in a database file. There are two types of access paths: keyed sequence and arrival sequence. With the copy function, you can process records in a database file in either arrival sequence or keyed sequence." />
<meta name="DC.subject" content="access path, keyed sequence access path, arrival sequence access path, copying file, record sequence for, sequence of copied records, physical file, copying, sequence" />
<meta name="keywords" content="access path, keyed sequence access path, arrival sequence access path, copying file, record sequence for, sequence of copied records, physical file, copying, sequence" />
<meta name="DC.Relation" scheme="URI" content="rbal3bcfuc.htm" />
<meta name="DC.Relation" scheme="URI" content="rbal3selrecords.htm" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rbal3recsq" />
<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> Record sequence and copying</title>
</head>
<body id="rbal3recsq"><a name="rbal3recsq"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1"> Record sequence and copying</h1>
<div><p>The <dfn class="term">access path</dfn> is the sequence in which records are
organized in a database file. There are two types of access paths: <dfn class="term">keyed
sequence</dfn> and <dfn class="term">arrival sequence</dfn>. With the copy function,
you can process records in a database file in either arrival sequence or keyed
sequence.</p>
<p>An arrival sequence copy transfers records in the order in
which they physically exist in the from-file. Relative record numbers represent
this order. The <dfn class="term">relative record number</dfn> is the position where
the records physically exist in storage. Because records are always added
to the end of the file, the relative record number represents the order in
which records arrived in the file.</p>
<p>A keyed sequence copy selects and transfers records by key value from a
keyed physical file. This might result in a different physical order in the
to-file. The to-file will be a reorganized version of the from-file. The relative
record number of a specific record might change when a file is copied by key
value:</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="hsides" border="0" rules="none"><thead align="left"><tr><th align="center" valign="bottom" width="33.33333333333333%" id="d0e51">Relative record number</th>
<th align="center" valign="bottom" width="33.33333333333333%" id="d0e53">Arrival sequence</th>
<th align="center" valign="bottom" width="33.33333333333333%" id="d0e55">Keyed sequence</th>
</tr>
</thead>
<tbody><tr><td align="center" valign="top" width="33.33333333333333%" headers="d0e51 ">1</td>
<td align="center" valign="top" width="33.33333333333333%" headers="d0e53 ">1011</td>
<td align="center" valign="top" width="33.33333333333333%" headers="d0e55 ">0016</td>
</tr>
<tr><td align="center" valign="top" width="33.33333333333333%" headers="d0e51 ">2 </td>
<td align="center" valign="top" width="33.33333333333333%" headers="d0e53 ">0762 </td>
<td align="center" valign="top" width="33.33333333333333%" headers="d0e55 ">0762 </td>
</tr>
<tr><td align="center" valign="top" width="33.33333333333333%" headers="d0e51 ">3 </td>
<td align="center" valign="top" width="33.33333333333333%" headers="d0e53 ">0810 </td>
<td align="center" valign="top" width="33.33333333333333%" headers="d0e55 ">0810 </td>
</tr>
<tr><td align="center" valign="top" width="33.33333333333333%" headers="d0e51 ">4</td>
<td align="center" valign="top" width="33.33333333333333%" headers="d0e53 ">3729</td>
<td align="center" valign="top" width="33.33333333333333%" headers="d0e55 ">1011</td>
</tr>
<tr><td align="center" valign="top" width="33.33333333333333%" headers="d0e51 ">5</td>
<td align="center" valign="top" width="33.33333333333333%" headers="d0e53 ">0016</td>
<td align="center" valign="top" width="33.33333333333333%" headers="d0e55 ">3729</td>
</tr>
</tbody>
</table>
</div>
<p>You can copy a keyed physical file in arrival sequence by specifying the
FROMRCD or TORCD parameter on the COPY commands. When you do this, the keyed
sequence access path is not used to retrieve the records in key sequence.
The records are retrieved in arrival sequence. This is helpful when the physical
relative record location in the file is significant and needs to remain the
same as it is in the original file. Specifying FROMRCD(1) is a good way to
copy all the records in arrival sequence. Copying a physical file in arrival
sequence instead of keyed sequence is also faster.</p>
<p>The kind of copy you run is determined by the type of from-file and the
method of selecting records to copy. In general, files are copied using their
keyed sequence, if they have one, otherwise, their arrival sequence.</p>
<p>A copy from a keyed file to a keyed file typically places records at the
end of the to-file in key field order, by the from-file key, regardless of
their physical order in the from-file. But if you select records in the from-file
by relative record number (using the FROMRCD or TORCD parameter), they are
physically placed at the end of the to-file in relative record number order,
regardless of their keyed sequence in the from-file. The following example
shows the result of a COPY command that specifies from record 3 to record
5:</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><thead align="left"><tr><th colspan="3" align="left" valign="top" id="d0e108">From-file</th>
<th colspan="2" align="left" valign="top" id="d0e110">To-file</th>
</tr>
<tr><th align="left" valign="top" width="20%" id="d0e113">Relative record number</th>
<th align="left" valign="bottom" width="20%" id="d0e115">Key</th>
<th valign="top" width="17.77777777777778%" id="d0e117">&nbsp;</th>
<th align="left" valign="top" id="d0e118">Relative record number</th>
<th align="left" valign="bottom" width="23.703703703703706%" id="d0e120">Key</th>
</tr>
</thead>
<tbody><tr><td align="left" valign="top" width="20%" headers="d0e108 d0e113 ">1</td>
<td align="left" valign="top" width="20%" headers="d0e108 d0e115 ">1011</td>
<td valign="top" width="17.77777777777778%" headers="d0e108 d0e117 ">&nbsp;</td>
<td align="left" valign="top" headers="d0e110 d0e118 ">.</td>
<td align="left" valign="top" width="23.703703703703706%" headers="d0e110 d0e120 "></td>
</tr>
<tr><td align="left" valign="top" width="20%" headers="d0e108 d0e113 ">2</td>
<td align="left" valign="top" width="20%" headers="d0e108 d0e115 ">0762</td>
<td align="left" valign="top" width="17.77777777777778%" headers="d0e108 d0e117 ">&nbsp;</td>
<td align="left" valign="top" width="18.51851851851852%" headers="d0e110 d0e118 ">.</td>
<td align="left" valign="top" width="23.703703703703706%" headers="d0e110 d0e120 "></td>
</tr>
<tr><td align="left" valign="top" width="20%" headers="d0e108 d0e113 ">3</td>
<td align="left" valign="top" width="20%" headers="d0e108 d0e115 ">0810</td>
<td rowspan="3" align="left" valign="top" width="17.77777777777778%" headers="d0e108 d0e117 "> <p>&lt; Arrival<br />
&lt; Sequence<br />
&lt; Copy</p>
</td>
<td align="left" valign="top" width="18.51851851851852%" headers="d0e110 d0e118 ">1401</td>
<td align="left" valign="top" width="23.703703703703706%" headers="d0e110 d0e120 ">0810</td>
</tr>
<tr><td align="left" valign="top" width="20%" headers="d0e108 d0e113 ">4</td>
<td align="left" valign="top" width="20%" headers="d0e108 d0e115 ">3729</td>
<td align="left" valign="top" width="18.51851851851852%" headers="d0e110 d0e118 ">1402</td>
<td align="left" valign="top" width="23.703703703703706%" headers="d0e110 d0e120 ">3729</td>
</tr>
<tr><td align="left" valign="top" width="20%" headers="d0e108 d0e113 ">5</td>
<td align="left" valign="top" width="20%" headers="d0e108 d0e115 ">0016</td>
<td align="left" valign="top" width="18.51851851851852%" headers="d0e110 d0e118 ">1403</td>
<td align="left" valign="top" width="23.703703703703706%" headers="d0e110 d0e120 ">0016</td>
</tr>
</tbody>
</table>
</div>
<p>When the to-file has a keyed sequence, the records appear in correct order
in the to-file when using the keyed sequence access path. A copy by relative
record number always copies by arrival sequence.</p>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbal3bcfuc.htm" title="You can copy from a physical or logical database file, open query file, diskette file, tape file, or inline data file. The to-file can be a physical database file, diskette file, tape file, program-described printer file, or *PRINT.">Copy files: basic functions</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="rbal3selrecords.htm" title="You can use parameters on the copy commands to select only the specific records that you want to copy.">Select the records to copy</a></div>
</div>
</div>
</body>
</html>