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

140 lines
8.1 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="task" />
<meta name="DC.Title" content="Change a physical file description and attributes" />
<meta name="abstract" content="Sometimes when you make a change to a physical file description and then re-create the file, the level identifier can change. If the level identifier changes, you can either compile the program again or avoid recompiling using a logical file." />
<meta name="description" content="Sometimes when you make a change to a physical file description and then re-create the file, the level identifier can change. If the level identifier changes, you can either compile the program again or avoid recompiling using a logical file." />
<meta name="DC.subject" content="physical file, changing, descriptions, attributes" />
<meta name="keywords" content="physical file, changing, descriptions, attributes" />
<meta name="DC.Relation" scheme="URI" content="rbafochgfile.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafochgpfdaex1.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafochgpfdaex2.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="rbafochgpfda" />
<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>Change a physical file description and attributes</title>
</head>
<body id="rbafochgpfda"><a name="rbafochgpfda"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Change a physical file description and attributes</h1>
<div><p>Sometimes when you make a change to a physical file description
and then re-create the file, the level identifier can change. If the level
identifier changes, you can either compile the program again or avoid recompiling
using a logical file.</p>
<div class="section"> <p>For example, the level identifier changes if you add a field
to the file description, or change the length of an existing field. If the
level identifier changes, you can compile the program again that uses the
physical file. After the program is recompiled, it uses the new
level check identifier.</p>
<p>You can avoid compiling again by creating a
logical file that presents data to your programs in the original record format
of the physical file. Using this approach, the logical file has the same level
check identifier as the physical file before the change.</p>
<p>For example,
you decide to add a field to a physical file record format. To avoid compiling
your program again, follow these steps:</p>
</div>
<ol><li class="stepexpand"><span>Change the DDS and create a new physical file (FILEB in LIBA) to
include the new field:</span> <pre>CRTPF FILE(LIBA/FILEB) MBR(*NONE)...</pre>
<p>FILEB
does not have a member. (The old file FILEA is in library LIBA and has one
member MBRA.)</p>
</li>
<li class="stepexpand"><span>Copy the member of the old physical file to the new physical file: </span> <pre>CPYF FROMFILE(LIBA/FILEA) TOFILE(LIBA/FILEB)
FROMMBR(*ALL) TOMBR(*FROMMBR)
MBROPT(*ADD) FMTOPT(*MAP)</pre>
<p>The member in the new physical
file is automatically named the same as the member in the old physical file
because FROMMBR(*ALL) and TOMBR(*FROMMBR) are specified. The FMTOPT parameter
specifies to copy (*MAP) the data in the fields by field name.</p>
</li>
<li class="stepexpand"><span>Describe a new logical file (FILEC) that looks like the original
physical file (the logical file record format does <em>not</em> include the
new physical file field). Specify FILEB for the PFILE keyword. (When a level
check is done, the level identifier in the logical file and the level identifier
in the program match because FILEA and FILEC have the same format.)</span></li>
<li class="stepexpand"><span>Create the new logical file: </span> <pre>CRTLF FILE(LIBA/FILEC)...</pre>
</li>
<li class="stepexpand"><span>You can now perform one of the following operations:</span> <ol type="a"><li>Use an Override with Database File (OVRDBF) command in the appropriate
jobs to override the old physical file referred to in the program with the
logical file (the OVRDBF command parameters are described in more detail in <a href="rbafopreopn.htm#rbafopreopn">Database file processing: Runtime considerations</a>). <pre>OVRDBF FILE(FILEA) TOFILE(LIBA/FILEC)</pre>
</li>
<li>Delete the old physical file and rename the logical file to the name of
the old physical file so the file name in the program does not have to be
overridden. <pre>DLTF FILE(LIBA/FILEA)
RNMOBJ OBJ(LIBA/FILEC) OBJTYPE(*FILE)
NEWOBJ(FILEA)</pre>
</li>
</ol>
</li>
</ol>
<div class="section"> <p>The following tables illustrate the relationship of the record
formats used in the three files.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="border" border="1" rules="all"><caption>Table 1. FILEA (old
physical file)</caption><tbody><tr><td valign="top">FLDA</td>
<td valign="top">FLDB</td>
<td valign="top">FLDC</td>
<td valign="top">FLDD</td>
</tr>
</tbody>
</table>
</div>
<p>In FILEB, FLDB1 was added to the record format.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="border" border="1" rules="all"><caption>Table 2. FILEB (new physical file)</caption><tbody><tr><td valign="top" width="20%">&nbsp;</td>
<td align="left" valign="top" width="20%">&nbsp;</td>
<td valign="top" width="20%">FLDB1</td>
<td valign="top" width="20%">&nbsp;</td>
<td valign="top" width="20%">&nbsp;</td>
</tr>
</tbody>
</table>
</div>
<p>FILEC shares the record format of FILEA. FLDB1 is not used in the
record format for the logical file.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="border" border="1" rules="all"><caption>Table 3. FILEC
(logical file)</caption><tbody><tr><td valign="top">FLDA</td>
<td valign="top">FLDB</td>
<td valign="top">FLDC</td>
<td valign="top">FLDD</td>
</tr>
</tbody>
</table>
</div>
<p>When you make changes to a physical file, which causes you to create
the file again, all logical files referring to it must first be deleted before
you can delete and create a new physical file. After the physical file is
re-created, you can re-create or restore the logical files referring to it. </p>
</div>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rbafochgpfdaex1.htm">Example 1: Change a physical file description and attributes</a></strong><br />
This example shows how to create a new physical file with the same name in a different library.</li>
<li class="ulchildlink"><strong><a href="rbafochgpfdaex2.htm">Example 2: Change a physical file description and attributes</a></strong><br />
This example shows how to create new versions of files in the same library.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafochgfile.htm" title="These topics discuss how to change the database file descriptions and attributes. Considerations for changing fields in a file description are also included.">Change database file descriptions and attributes</a></div>
</div>
</div>
</body>
</html>