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

71 lines
4.6 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="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="Specify *UPDADD when copying files" />
<meta name="abstract" content="When you specify *UPDADD on the CPYF command, a from-file key value builds before the from-file record moves into the to-file. The from-file builds this key value by using the key specifications of the to-file." />
<meta name="description" content="When you specify *UPDADD on the CPYF command, a from-file key value builds before the from-file record moves into the to-file. The from-file builds this key value by using the key specifications of the to-file." />
<meta name="DC.Relation" scheme="URI" content="rbal3records.htm" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rbal3updadd" />
<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>Specify *UPDADD when copying files</title>
</head>
<body id="rbal3updadd"><a name="rbal3updadd"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Specify *UPDADD when copying files</h1>
<div><p>When you specify *UPDADD on the CPYF command, a from-file key value
builds before the from-file record moves into the to-file. The from-file builds
this key value by using the key specifications of the to-file.</p>
<p>Before the key value is built, the server performs any necessary field
or data mapping, data conversion, or record selection. The server checks the
to-file to see if this key value already exists in it (duplicate key of the
from-file data). If the key value does exist in the to-file, the from-file
record that contains the key value updates that to-file record.</p>
<div class="p">The following rules apply if you specify MBROPT(*UPDADD) on
the <a href="../cl/cpyf.htm">CPYF</a> command: <ul><li>The to-file must be a local database physical file that contains a primary
or unique key.</li>
<li>You cannot specify CRTFILE(*YES). The to-file must exist before you run
CPYF.</li>
<li>CPYF cannot copy from multiple formats.</li>
<li>Detected duplicate keys are not skipped but updated with the new from-file
record value. Duplicate key errors (CPF5026) are not included as ERRLVL errors.</li>
<li>CPF5027 will be included as an ERRLVL error. This error can occur if another
process has a record that is locked. To avoid this error, you might want to
pre-allocate the to-file within your job before performing the CPYF. You can
use the WAITRCD parameter on the <a href="../cl/crtpf.htm">CRTPF</a> and <a href="../cl/chgpf.htm">CHGPF</a> commands to limit the length of time that the commands
spend waiting for a record lock to be released in the to-file.</li>
<li>All existing FMTOPT values are allowed. However, when using MBROPT(*UPDADD),
take care to avoid updating records that you do not want to update. Also avoid
updating the same record multiple times when it is not what you want.</li>
<li>Nulls are not used in determining duplicate key values if FMTOPT(*NOCHK)
is specified or if the from-file is a device file.</li>
<li>You must have the minimum following authorities to the to-file: <ul><li>Object operational (*OBJOPR)</li>
<li>Add (*ADD)</li>
<li>Update (*UPD)</li>
</ul>
</li>
</ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbal3records.htm" title="Many iSeries copy commands allows you to add or replace existing data in the to-file specifying different attributes on the MBROPT paramete.">Add, replace, and update records (MBROPT parameter)</a></div>
</div>
</div>
</body>
</html>