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

179 lines
11 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="Copy files: commands" />
<meta name="abstract" content="You can copy records to and from files with commands discussed in this topic." />
<meta name="description" content="You can copy records to and from files with commands discussed in this topic." />
<meta name="DC.subject" content="Copy File (CPYF) command, functions, CPYF (Copy File) command, copy command, copying, records, record, deleted record, in the from-file, parameter, copying files, Copy File (CPYF) command, specific copy functions, command, CL, CPYF (Copy File), specific functions, deleted, from-file" />
<meta name="keywords" content="Copy File (CPYF) command, functions, CPYF (Copy File) command, copy command, copying, records, record, deleted record, in the from-file, parameter, copying files, Copy File (CPYF) command, specific copy functions, command, CL, CPYF (Copy File), specific functions, deleted, from-file" />
<meta name="DC.Relation" scheme="URI" content="rbal3copyfileover.htm" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rbal3cpyfcmds" />
<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>Copy files: commands</title>
</head>
<body id="rbal3cpyfcmds"><a name="rbal3cpyfcmds"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Copy files: commands</h1>
<div><p>You can copy records to and from files with commands discussed
in this topic.</p>
<div class="p">To copy records to and from files, use the following commands: <dl><dt class="dlterm"><a href="../cl/cpyf.htm">CPYF</a></dt>
<dd>Copy File copies all or part of a file from the database or external device
to the database or external device.</dd>
<dt class="dlterm"><a href="../cl/cpyfrmtap.htm">CPYFRMTAP</a></dt>
<dd>Copy from Tape copies from a tape file to a database or device file. The
from-file must be a tape file, but the to-file can be a physical file, diskette
file, tape file, or program-described printer file. You can obtain a formatted
listing of the records by using QSYSPRT.</dd>
<dt class="dlterm"><a href="../cl/cpytotap.htm">CPYTOTAP</a></dt>
<dd>Copy to Tape copies from a database or device file to a tape file. The
to-file must be a tape file, but the from-file can be a physical, logical,
diskette, tape, or inline data file.</dd>
<dt class="dlterm"><a href="../cl/cpysrcf.htm">CPYSRCF</a></dt>
<dd>Copy Source File copies a database source file to a source physical file
and converts the data in the from-file to the to-file CCSID. You can create
a formatted listing by using QSYSPRT (the file is changed for source records
and is different from other copy command file formats). Record data is copied
from the from-file to the to-file, disregarding differences in record formats
(similar to the FMTOPT(*NOCHK) parameter option on the CPYF command, except
for the CCSIDs.)</dd>
<dt class="dlterm"><a href="../cl/cpyfrmqryf.htm">CPYFRMQRYF</a></dt>
<dd>Copy from Query File copies an open query file to a database or device
file.</dd>
</dl>
</div>
<p>The server does not reclaim DDM conversations for a job when a copy command
produces an error. </p>
<p>If you specify a DDM file and a local file on the CPYF or CRYSRCF commands,
the server does not verify that the remote and local files are not the same
file on the source server. If you specify one DDM file, you can potentially
copy to and from the same file.</p>
<p>For information about how to copy DBCS-open fields to graphic fields (including
the option of removing trailing single-byte blanks for the DBCS-open field
first), see <a href="rbal3ptr2.htm#rbal3ptr2">DBCS-graphic fields using FMTOPT(*MAP) or FMTOPT(*NOCHK)</a>.</p>
<p>Throughout this topic, unless the text specifies a specific command, the
term <dfn class="term">copy commands</dfn> refers to all the commands just described.</p>
<p>The device and database files where you can perform copy operations are
shown in <a href="#rbal3cpyfcmds__rbal3cpyop">Table 1</a>.</p>
<div class="tablenoborder"><a name="rbal3cpyfcmds__rbal3cpyop"><!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="rbal3cpyfcmds__rbal3cpyop" width="100%" frame="hsides" border="0" rules="none"><caption>Table 1. Copy operations</caption><thead align="left"><tr><th align="left" valign="bottom" width="50%" id="d0e138">From-files</th>
<th align="left" valign="bottom" width="50%" id="d0e140">To-files</th>
</tr>
</thead>
<tbody><tr><td align="left" valign="top" width="50%" headers="d0e138 ">DDM</td>
<td align="left" valign="top" width="50%" headers="d0e140 ">DDM</td>
</tr>
<tr><td align="left" valign="top" width="50%" headers="d0e138 ">Diskette<sup>1</sup></td>
<td align="left" valign="top" width="50%" headers="d0e140 ">Diskette<sup>1</sup></td>
</tr>
<tr><td align="left" valign="top" width="50%" headers="d0e138 ">Logical</td>
<td align="left" valign="top" width="50%" headers="d0e140 ">Physical<sup>2</sup></td>
</tr>
<tr><td align="left" valign="top" width="50%" headers="d0e138 ">Open query<sup>3</sup></td>
<td align="left" valign="top" width="50%" headers="d0e140 ">Printer</td>
</tr>
<tr><td align="left" valign="top" width="50%" headers="d0e138 ">Physical</td>
<td align="left" valign="top" width="50%" headers="d0e140 ">*PRINT<sup>4</sup></td>
</tr>
<tr><td align="left" valign="top" width="50%" headers="d0e138 ">Inline data<sup>5</sup></td>
<td align="left" valign="top" width="50%" headers="d0e140 "> Tape</td>
</tr>
<tr><td align="left" valign="top" width="50%" headers="d0e138 "> Tape</td>
<td valign="top" width="50%" headers="d0e140 ">&nbsp;</td>
</tr>
<tr><td colspan="2" align="left" valign="top" headers="d0e138 d0e140 "> <div class="note"><span class="notetitle">Notes:</span> <dl><dt class="dlterm"><sup>1</sup></dt>
<dd>If the from-file and the to-file are both diskette files, the to-file
must be spooled.</dd>
<dt class="dlterm"><sup>2</sup></dt>
<dd>If the to-file does not exist before the copy operation, the copy operation
will create a physical file as the to-file if you specified: <ul><li>CRTFILE(*YES) on the CPYF command and the from-file is a physical or logical
file.</li>
<li>CRTFILE(*YES) on the CPYFRMQRYF command.</li>
</ul>
</dd>
<dt class="dlterm"><sup>3</sup></dt>
<dd>Open query files can only be copied by using the CPYFRMQRYF command. CPYFRMQRYF
is not allowed for open query files that use DDM files.</dd>
<dt class="dlterm"><sup>4</sup></dt>
<dd>If TOFILE(*PRINT) is specified, the from-file records are copied to the
IBM-supplied printer device file QSYSPRT and formatted according to the OUTFMT
parameter.</dd>
<dt class="dlterm"><sup>5</sup></dt>
<dd>An inline data file (which is handled like a device file) is included
as part of a batch job when the job is read by a reader program.</dd>
</dl>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="p">While copying records, some of the copy commands can perform the following
functions: <ul><li>Copy from or to the first file member, a particular file member, a generic
set of members, or all file members (FROMMBR and TOMBR parameters).</li>
<li>Add a member to a physical to-file if the member does not exist.</li>
<li>Add records to an existing file member, replace the contents of an existing
member (MBROPT parameter), or update duplicate key records in a to-file member.</li>
<li>Select certain records to copy by one of the following methods: <ul><li>Selecting records by record format name when a multi-format logical file
is copied (RCDFMT parameter).</li>
<li>Specifying records by starting at a relative record number and ending
at a relative record number (FROMRCD and TORCD parameters).</li>
<li>Specifying records by starting with a specific record key value and ending
with another specific record key value (FROMKEY and TOKEY parameters).</li>
<li>Specifying the number of records that you want to copy (NBRRCDS parameter).</li>
<li>Selecting records by the contents of one or more character positions in
the record or in a field in the record (INCCHAR parameter).</li>
<li>Selecting records according to the values that are contained in one or
more fields in the record (INCREL parameter).</li>
<li>Disregard or include deleted records in the from-file during the copy
if processing the from-file in arrival sequence (COMPRESS parameter).</li>
</ul>
</li>
</ul>
<ul><li>Print copied records, excluded records, or error records (PRINT parameter)
in a specified format (OUTFMT parameter).</li>
<li>Copy records whose from-file and to-file record formats are different
(FMTOPT parameter). When formats are different, you can perform any of the
following actions: <ul><li>Map fields whose names are the same in the from-file and to-file record
formats and whose field attributes are compatible (*MAP value).</li>
<li>Drop fields in the from-file record format that do not exist in the to-file
record format (*DROP value).</li>
<li>Copy data directly (left to right) disregarding any differences (*NOCHK
value).</li>
</ul>
</li>
<li>Copy from a source file to a data file or from a data file to a source
file. If the from-file or to-file is a device file, this function is automatic.
If both files are database files, you must specify FMTOPT(*CVTSRC).</li>
<li>Change sequence numbers and zero dates in the sequence number and date
source fields when copying to a source physical file (SRCOPT parameter). When
renumbering is to be done, the starting sequence number and the increment
value can be specified (SRCSEQ parameter).</li>
<li>End the copy after a specified number of recoverable errors are encountered
(ERRLVL parameter).</li>
<li>Create the to-file as part of the copy operation (CRTFILE parameter).</li>
</ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbal3copyfileover.htm" title="You can use the copy function to move data between device files, between database files (including distributed DB2 Multisystem files), or between device and database files.">Copy files: overview</a></div>
</div>
</div>
</body>
</html>