ibm-information-center/dist/eclipse/plugins/i5OS.ic.cl_5.4.0.1/copy.htm

594 lines
29 KiB
HTML

<!doctype html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Copy Object (COPY)</title>
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body bgcolor="white">
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<a name="COPY.Top_Of_Page"></a>
<h2>Copy Object (COPY)</h2>
<table width="100%">
<tr>
<td valign="top" align="left"><b>Where allowed to run: </b>All environments (*ALL)<br>
<b>Threadsafe: </b>No
</td>
<td valign="top" align="right">
<a href="#COPY.PARAMETERS.TABLE">Parameters</a><br>
<a href="#COPY.COMMAND.EXAMPLES">Examples</a><br>
<a href="#COPY.ERROR.MESSAGES">Error messages</a></td>
</tr>
</table>
<div> <a name="COPY"></a>
<p>The Copy Object (COPY) command copies a single object or a group of objects.
</p>
<p>By default, if the target object already exists, the copy of that individual object will fail. If the REPLACE(*YES) parameter is specified the target object is overwritten. The newly created object must be renamed if it is stored in the same directory as the original object. If it is stored in a directory other than the one that contains the original object, it can retain the name of the original object.
</p>
<p>An object name pattern can be used to copy a group of related objects. A pattern cannot be used to copy a group of objects from one file system to another unless the names in the source meet the requirements of the target file system. For example, a file named /OBJA in QOpenSys cannot be copied to directory /QSYS.LIB/MYLIB.LIB/FILEA.FILE, because the QSYS.LIB file system requires a name in the form OBJA.MBR when writing to a file. All names found within the pattern would fail if they did not meet the requirement of name.object-type.
</p>
<p>The copy command can also be used to copy a directory tree where the directory, its contents, and the contents of all of its subdirectories are copied. A subtree copy will attempt to preserve as many attributes from the original objects as possible. This would make it possible to migrate data from one file system to another.
</p>
<p>If the original object is a read-only file (a file that has the PC read-only attribute flag turned on), and SUBTREE(*NODIR) is specified, the newly created object will <b>not</b> be read-only. This follows the conventions of the OS/2 hierarchical file system (HFS).
</p>
<p>
<b>Note: </b>When the value of the <b>Directory subtree (SUBTREE)</b> parameter is *NONE or *ALL, the PC read-only attribute flag will be copied. The subtree copy is intended to preserve as many attributes of the original objects as possible.
</p>
<p>When the <b>To directory (TODIR)</b> parameter is specified, the object is copied to that directory with the same name. The copied object is authorized the same as the original object. The user who issues the command owns the copied object if the <b>Owner (OWNER)</b> parameter value is *NEW.
</p>
<p>When copying a file with SUBTREE(*NODIR) specified to the "root" (/), QOpenSys, QDLS, and UDFS file systems, the Last access date/time and the Data change date/time are preserved in the new file, and the Attribute change date/time is updated to the current time. The Last access date/time of the original file is updated to the current time. In the case of copying to a database file member (*MBR) in the QSYS.LIB or independent ASP QSYS.LIB file systems, the Data change date/time is updated as well.
</p>
<p>
<b>Note: </b>If the parameter SUBTREE(*YES) is specified the Create date/time is updated as well.
</p>
<p>This command is an alias for the Copy Object (CPY) command and can also be issued using the following alternative command name:
</p>
<ul>
<li>CPY
</li>
</ul>
<p>In addition to the COPY command, the Copy To Stream File (CPYTOSTMF) and Copy From Stream File (CPYFRMSTMF) commands can be used to copy between stream files and database member files or save files.
</p>
<p>For more information about integrated file system commands, see the Integrated file system information in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
</p>
<p><b>Restrictions:</b>
</p>
<ol>
<li>The copy command will copy the object's public and private authorities where it is supported.
</li>
</ol>
<p>
<b>Note: </b>The authority requirements for this command are complex with respect to file systems, object types, requested operations etc.. Therefore, see the iSeries Security Reference, SC41-5302 book for information about the required authorities for this command.
</p>
<p><b>QSYS.LIB and independent ASP QSYS.LIB File System Differences</b>
</p>
<ul>
<li>If copying to a database file member from a different object type, or copying to or from a member not in the current job's library name space, some attributes are copied, see Integrated file system information in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter for more information.
</li>
<li>When copying a database member to another member within the same library name space, attributes are handled in the same manner as the Copy File (CPYF) command (this only applies if the <b>Data Format (DTAFMT)</b> parameter is *BINARY).
</li>
<li>Other object types copied are handled the way the Create Duplicate Object (CRTDUPOBJ) command handles attributes (this only applies if the DTAFMT parameter is *BINARY).
</li>
<li>The REPLACE(*YES) option is only supported on file members, user spaces, and save files when the target object exists. All other object types will fail when the target object exists.
</li>
</ul>
<p><b>QOPT File System Differences</b>
</p>
<ul>
<li>If copying a file within the QOPT file system, the Create date/time is always updated to the current time.
</li>
</ul>
<p><b>QNetWare File System Differences</b>
</p>
<ul>
<li>If copying a file or directory to a location on the same server, the owner of the target object is always the caller of the command and the PC read-only flag is not copied.
</li>
<li>The scan-related attributes are not copied.
</li>
</ul>
<p><b>QFileSvr.400 File System Differences</b>
</p>
<ul>
<li>The OWNER(*KEEP) parameter is not supported when copying an object to the QFileSvr.400 File System. The copy will fail with error message CPFA0AD.
</li>
<li>The scan-related attributes are not copied.
</li>
</ul>
<p><b>Network File System (NFS) Differences</b>
</p>
<ul>
<li>The OWNER(*KEEP) parameter is not supported when copying an object to or from a mounted Network File System (NFS) directory. The copy will fail with error message CPFA0AD.
</li>
<li>The scan-related attributes are not copied.
</li>
</ul>
</div>
<table width="100%">
<tr><td align="right"><a href="#COPY.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div>
<h3><a name="COPY.PARAMETERS.TABLE">Parameters</a></h3>
<table border="1" cellpadding="4" cellspacing="0">
<!-- col1="10" col2="15" col3="30" col4="10" -->
<tr>
<th bgcolor="aqua" valign="bottom" align="left">Keyword</th>
<th bgcolor="aqua" valign="bottom" align="left">Description</th>
<th bgcolor="aqua" valign="bottom" align="left">Choices</th>
<th bgcolor="aqua" valign="bottom" align="left">Notes</th>
</tr>
<tr>
<td valign="top"><a href="#COPY.OBJ"><b>OBJ</b></a></td>
<td valign="top">Object</td>
<td valign="top"><i>Path name</i></td>
<td valign="top">Required, Positional 1</td>
</tr>
<tr>
<td valign="top"><a href="#COPY.TODIR"><b>TODIR</b></a></td>
<td valign="top">To directory</td>
<td valign="top"><i>Path name</i>, <b><u>'.'</u></b></td>
<td valign="top">Optional, Positional 2</td>
</tr>
<tr>
<td valign="top"><a href="#COPY.TOOBJ"><b>TOOBJ</b></a></td>
<td valign="top">To object</td>
<td valign="top"><i>Path name</i></td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#COPY.SYMLNK"><b>SYMLNK</b></a></td>
<td valign="top">Symbolic link</td>
<td valign="top"><b><u>*NO</u></b>, *YES</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#COPY.FROMCCSID"><b>FROMCCSID</b></a></td>
<td valign="top">From CCSID</td>
<td valign="top">1-65533, <b><u>*OBJ</u></b>, *PCASCII, *JOBCCSID</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#COPY.TOCCSID"><b>TOCCSID</b></a></td>
<td valign="top">To CCSID</td>
<td valign="top">1-65533, <b><u>*OBJ</u></b>, *CALC, *STDASCII, *PCASCII, *JOBCCSID</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#COPY.DTAFMT"><b>DTAFMT</b></a></td>
<td valign="top">Data Format</td>
<td valign="top"><b><u>*BINARY</u></b>, *TEXT</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#COPY.SUBTREE"><b>SUBTREE</b></a></td>
<td valign="top">Directory subtree</td>
<td valign="top"><b><u>*NODIR</u></b>, *NONE, *ALL</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#COPY.REPLACE"><b>REPLACE</b></a></td>
<td valign="top">Replace object</td>
<td valign="top"><b><u>*NO</u></b>, *YES</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#COPY.OWNER"><b>OWNER</b></a></td>
<td valign="top">Owner</td>
<td valign="top"><b><u>*NEW</u></b>, *KEEP</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#COPY.FROMCODPAG"><b>FROMCODPAG</b></a></td>
<td valign="top">From Code Page</td>
<td valign="top">1-32767, <b><u>*OBJ</u></b>, *PCASCII</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#COPY.TOCODEPAGE"><b>TOCODEPAGE</b></a></td>
<td valign="top">To Code Page</td>
<td valign="top">1-32767, <b><u>*OBJ</u></b>, *CALC, *STDASCII, *PCASCII</td>
<td valign="top">Optional</td>
</tr>
</table>
<table width="100%">
<tr><td align="right"><a href="#COPY.Top_Of_Page">Top</a></td></tr>
</table>
</div>
<div> <a name="COPY.OBJ"></a>
<h3>Object (OBJ)</h3>
<p>Specifies the path name of the object or a pattern to match the name of the object to be copied.
</p>
<p>The object path name can be either a simple name or a name that is qualified with the name of the directory in which the object is located. A pattern can be specified in the last part of the path name. An asterisk (*) matches any number of characters and a question mark (?) matches a single character. If the path name is qualified or contains a pattern, it must be enclosed in apostrophes.
</p>
<p>For more information on specifying path names, refer to "Object naming rules" in the CL concepts and reference topic in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
</p>
<p>
<b>Note: </b>An object name pattern can be used to copy multiple objects only when the <b>To directory (TODIR)</b> parameter is specified.
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#COPY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="COPY.TODIR"></a>
<h3>To directory (TODIR)</h3>
<p>Specifies the path name of the directory to copy the object into. When this parameter is used, the copied object has the same name as the <b>Object (OBJ)</b> parameter specified.
</p>
<dl>
<dt><b><u>.</u></b></dt>
<dd>The object is copied to the current directory with the same name as the existing object.
</dd>
<dt><b><i>directory-path-name</i></b></dt>
<dd>Specify the path name of the existing directory to copy the object into.
</dd>
</dl>
<p>For more information on specifying path names, refer to "Object naming rules" in the CL concepts and reference topic in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#COPY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="COPY.TOOBJ"></a>
<h3>To object (TOOBJ)</h3>
<p>Specifies the path name of the copied object. This is the name of the new object, including the path or relative path.
</p>
<p>For more information on specifying path names, refer to "Object naming rules" in the CL concepts and reference topic in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#COPY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="COPY.SYMLNK"></a>
<h3>Symbolic link (SYMLNK)</h3>
<p>Specifies whether to copy the object or a symbolic link to the object.
</p>
<dl>
<dt><b><u>*NO</u></b></dt>
<dd>The object, not a symbolic link to the object, is copied.
</dd>
<dt><b>*YES</b></dt>
<dd>If the object to be copied is a symbolic link, the symbolic link is copied, instead of copying the object that the symbolic link points to.
</dd>
</dl>
<p>
<b>Note: </b>If a symbolic link is encountered during the copy of a subtree, the object it points to is copied. If the symbolic link points to a directory, the directory is copied but its contents are not. This is true even when the top-level directory of the directory tree is actually a symbolic link to a directory.
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#COPY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="COPY.FROMCCSID"></a>
<h3>From CCSID (FROMCCSID)</h3>
<p>Specifies the method for obtaining the coded character set identifier (CCSID) for the source of the copy operation. This CCSID will be used for data conversion, if requested. This parameter is ignored if the object specified on the <b>Object (OBJ)</b> parameter is not a regular file. A regular file is a file that supports the integrated file system input/output (I/O) operations open, read, and write.
</p>
<dl>
<dt><b><u>*OBJ</u></b></dt>
<dd>Use the data CCSID of the object to be copied.
</dd>
<dt><b>*PCASCII</b></dt>
<dd>Use the data CCSID of the object to be copied to compute a CCSID in the Microsoft Windows encoding scheme (x4105) (Microsoft, Windows, Windows NT, and the Windows 95 logo are registered trademarks of Microsoft Corporation). Use this as the CCSID from which the data will be converted when DTAFMT(*TEXT) is specified. This option allows data from PCs to be converted properly if the data was created using Microsoft Windows.
</dd>
<dt><b>*JOBCCSID</b></dt>
<dd>The CCSID from the default job CCSID is used.
</dd>
<dt><b><i>1-65533</i></b></dt>
<dd>Specify a CCSID value.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#COPY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="COPY.TOCCSID"></a>
<h3>To CCSID (TOCCSID)</h3>
<p>Specifies the data coded character set identifier (CCSID) for the target of the copy operation. This parameter is ignored if the object specified on the <b>Object (OBJ)</b> parameter is not a regular file. A regular file is a file that supports the integrated file system input/output (I/O) operations open, read, and write.
</p>
<dl>
<dt><b><u>*OBJ</u></b></dt>
<dd>Use the data CCSID of the object to be copied. If this CCSID cannot be used by the file system that the object is to be copied into, the copy operation will fail.
</dd>
<dt><b>*CALC</b></dt>
<dd>Use the data CCSID of the object to be copied. If this CCSID cannot be used by the file system that the object is to be copied into, allow the file system to determine a different CCSID and continue with the copy.
</dd>
<dt><b>*STDASCII</b></dt>
<dd>Compute a CCSID in the IBM PC Data encoding scheme (x2100), based on the source file's CCSID. Associate this CCSID for the target of the copy operation and, if DTAFMT(*TEXT) is specified, also use this CCSID for the data conversion. If this CCSID cannot be used by the file system that the object is to be copied into, the copy operation will fail.
</dd>
<dt><b>*PCASCII</b></dt>
<dd>Compute a CCSID in the Microsoft Windows encoding scheme (x4105), based on the source file's CCSID (Microsoft, Windows, Windows NT, and the Windows 95 logo are registered trademarks of Microsoft Corporation). Associate this CCSID with the target of the copy operation and, if DTAFMT(*TEXT) is specified, also use this CCSID for the data conversion. This option allows the resulting data to be used by Microsoft Windows applications. If this CCSID cannot be used by the file system that the object is to be copied into, the copy operation will fail.
</dd>
<dt><b>*JOBCCSID</b></dt>
<dd>The CCSID from the default job CCSID is used.
</dd>
<dt><b><i>1-65533</i></b></dt>
<dd>Specify a CCSID value.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#COPY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="COPY.DTAFMT"></a>
<h3>Data Format (DTAFMT)</h3>
<p>Specifies the format of the data in the file to be copied.
</p>
<dl>
<dt><b><u>*BINARY</u></b></dt>
<dd>The file contains data in binary format (such as an executable file).
<p>Do not convert data on the copy. However, if the object to be copied to has a different CCSID than the source object, all extended attributes will be converted into the CCSID of the new object before being set.
</p>
</dd>
<dt><b>*TEXT</b></dt>
<dd>The file contains data in textual form. Convert data to the CCSID of the new object during the copy. The data is processed as text during the copy.
<p>If a database member is to be copied to a stream file, any line-formatting characters (such as carriage return, tab, and end-of-file) are just converted from one CCSID to another.
</p>
<p>If a stream file is to be copied to a database member, the stream file must contain end-of-line characters or the copy will fail. If the stream file does contain end-of-line characters, the following actions are performed during the copy to a database file.
</p>
<ul>
<li>End-of-line characters are removed.
</li>
<li>Records are padded with blanks (for a source physical file member) or nulls (for a data physical file member).
</li>
<li>Tab characters are replaced by the appropriate number of blanks to the next tab position.
</li>
</ul>
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#COPY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="COPY.SUBTREE"></a>
<h3>Directory subtree (SUBTREE)</h3>
<p>Specifies whether or not to copy a directory subtree if the object specified by <b>Object (OBJ)</b> is a directory.
</p>
<dl>
<dt><b><u>*NODIR</u></b></dt>
<dd>The object or objects specified by OBJ are copied. If an object is a directory, the copy will fail unless the target directory specified on the TODIR keyword is the directory in which the source object already exists. In this case, no action is performed and a successful completion message is issued.
</dd>
<dt><b>*NONE</b></dt>
<dd>The objects specified by OBJ are copied. Directory objects are copied but their contents are not copied.
</dd>
<dt><b>*ALL</b></dt>
<dd>The objects specified by OBJ are copied. Directory objects are copied as well as their contents and the contents of all subdirectories.
<p>Pattern matching on the OBJ parameter only applies to the first level object. If the first level object is a directory, the pattern matching does not apply to its contents or the contents of its subdirectories.
</p>
<p>If SUBTREE(*ALL) is specified, individual completion messages for each object are not issued. A final message is issued to indicate how many copies succeeded and how many failed. If objects did fail to copy, the command will issue a diagnostic message for each copy that failed.
</p>
<p>There are a few differences in how attributes are copied when SUBTREE(*NONE) or SUBTREE(*ALL) is specified instead of the default SUBTREE(*NODIR). A directory subtree copy preserves as much of the original objects' attributes as possible.
</p>
<ul>
<li>The PC read-only attribute flag is turned off in the copied object. If SUBTREE(*NONE) or SUBTREE(*ALL) is specified the flag will be copied.
</li>
<li>The Create date/time will be copied if SUBTREE(*NONE) or SUBTREE(*ALL) is specified (by default it is updated to the current time).
</li>
</ul>
<p>
<b>Note: </b>The copy will fail if the target object is a subdirectory of the source object, or if the target object matches the source object.
</p>
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#COPY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="COPY.REPLACE"></a>
<h3>Replace object (REPLACE)</h3>
<p>Specifies whether the target object is replaced if it already exists.
</p>
<dl>
<dt><b><u>*NO</u></b></dt>
<dd>The target object is not replaced if it already exists.
</dd>
<dt><b>*YES</b></dt>
<dd>If the target object already exists, it is replaced. If REPLACE(*YES) is specified with a directory object, the attributes of the existing target directory are changed but the objects that the directory contains are not removed.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#COPY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="COPY.OWNER"></a>
<h3>Owner (OWNER)</h3>
<p>Specifies the owner of the newly created object.
</p>
<dl>
<dt><b><u>*NEW</u></b></dt>
<dd>The owner of the new object is the current user profile of the job. Even if the target object already exists and is owned by someone other than the current user profile of the job, the owner of the target object will be changed to be the current user profile of the job.
</dd>
<dt><b>*KEEP</b></dt>
<dd>The owner of the new object is the same as the owner of the original object to be copied.
<p>Some file systems do not support changing the owner of certain object types. For example, the owner of *MBR objects in the QSYS.LIB and independent ASP QSYS.LIB file systems will be determined by the owner of the *FILE object that they are copied into.
</p>
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#COPY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="COPY.FROMCODPAG"></a>
<h3>From Code Page (FROMCODPAG)</h3>
<p>Specifies the method for obtaining the code page for source of the copy operation. This code page will be used for data conversion, if requested. This parameter is ignored if the object specified on the <b>Object (OBJ)</b> parameter is not a regular file. A regular file is a file that supports the integrated file system input/output (I/O) operations open, read, and write.
</p>
<p>
<b>Note: </b>This parameter is replaced by <b>From CCSID (FROMCCSID)</b> but the FROMCODPAG parameter can still be used. However, because this parameter may be removed in a later release, whenever possible use the FROMCCSID parameter.
</p>
<dl>
<dt><b><u>*OBJ</u></b></dt>
<dd>Use the data code page of the object to be copied.
</dd>
<dt><b>*PCASCII</b></dt>
<dd>Use the data code page of the object to be copied to compute a code page in the Microsoft Windows encoding scheme (x4105) (Microsoft, Windows, Windows NT, and the Windows 95 logo are registered trademarks of Microsoft Corporation). Use this as the code page from which the data will be converted when DTAFMT(*TEXT) is specified. This option allows data from PCs to be converted properly if the data was created using Microsoft Windows.
</dd>
<dt><b><i>1-32767</i></b></dt>
<dd>Specify a code page value.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#COPY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="COPY.TOCODEPAGE"></a>
<h3>To Code Page (TOCODEPAGE)</h3>
<p>Specifies the data code page for the target of the copy operation. This parameter is ignored if the object specified on the <b>Object (OBJ)</b> parameter is not a regular file. A regular file is a file that supports the integrated file system input/output (I/O) operations open, read, and write.
</p>
<p>
<b>Note: </b>This parameter is replaced by <b>To CCSID (TOCCSID)</b> but the TOCODEPAGE parameter can still be used. However, because this parameter may be removed in a later release, whenever possible use the TOCCSID parameter.
</p>
<dl>
<dt><b><u>*OBJ</u></b></dt>
<dd>Use the data code page of the object to be copied. If this code page cannot be used by the file system that the object is to be copied into, the copy operation will fail.
</dd>
<dt><b>*CALC</b></dt>
<dd>Use the data code page of the object to be copied. If this code page cannot be used by the file system that the object is to be copied into, allow the file system to determine a different code page and continue with the copy.
</dd>
<dt><b>*STDASCII</b></dt>
<dd>Compute a code page in the IBM PC Data encoding scheme (x2100), based on the source file's code page. Associate this code page for the target of the copy operation and, if DTAFMT(*TEXT) is specified, also use this code page for the data conversion. If this code page cannot be used by the file system that the object is to be copied into, the copy operation will fail.
</dd>
<dt><b>*PCASCII</b></dt>
<dd>Compute a code page in the Microsoft Windows encoding scheme (x4105), based on the source file's code page. Associate this code page with the target of the copy operation and, if DTAFMT(*TEXT) is specified, also use this code page for the data conversion. This option allows the resulting data to be used by Microsoft Windows applications. If this code page cannot be used by the file system that the object is to be copied into, the copy operation will fail.
</dd>
<dt><b><i>1-32767</i></b></dt>
<dd>Specify a code page value. If this code page cannot be used by the file system that the object is to be copied into, the copy operation will fail.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#COPY.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="COPY.COMMAND.EXAMPLES">Examples</a> </h3>
<p>The alternative command name for COPY is CPY. The following examples use the alternative command name, but COPY can be replaced directly for CPY in all of them.
</p>
<p><b>Example 1: Copying a File</b>
</p>
<p>
<pre>
CPY OBJ('DECEMBER-1994-MONTHLY-PAYROLL-FILE') TOOBJ('PAY')
</pre>
</p>
<p>This command creates another file named PAY that is a duplicate of the file named DECEMBER-1994-MONTHLY-PAYROLL-FILE.
</p>
<p><b>Example 2: Copying a File to Another Directory</b>
</p>
<p>
<pre>
CPY OBJ('PAY') TODIR('MYDIR')
</pre>
</p>
<p>This command creates another file named PAY in directory MYDIR.
</p>
<p><b>Example 3: Copying a Symbolic Link</b>
</p>
<p>
<pre>
CPY OBJ('SL1') TOOBJ('YOURDIR/SL2') SYMLNK(*YES)
</pre>
</p>
<p>If SL1 is a symbolic link, the new object YOURDIR/SL2 is also a symbolic link. If SYMLNK(*NO) was specified, the new object would be a copy of whatever SL1 pointed to, as long as it was a legal candidate for the copy function.
</p>
<p><b>Example 4: Copying with Conversion</b>
</p>
<p>
<pre>
CPY OBJ('/DATAFB')
TOOBJ('/QSYS.LIB/APP1.LIB/DATA.FILE/DATAFB.MBR')
TOCCSID(*CALC) DTAFMT(*TEXT)
</pre>
</p>
<p>This command copies stream file 'DATAFB' to the database file 'DATAFB.MBR'. By specifying TOCCSID(*CALC), the file system being copied to (the QSYS.LIB file system in this case) will try to create the new member in the same coded character set identifier (CCSID) as '/DATAFB'. If this fails (in this case, if 'DATA.FILE is not in the same CCSID as 'DATAFB'), the file system will be allowed to choose an appropriate CCSID and complete the copy. By specifying DTAFMT(*TEXT), the data in 'DATAFB' is handled as text and is converted into the CCSID chosen for the new file 'DATAFB.MBR'.
</p>
<p><b>Example 5: Copying a Directory Subtree</b>
</p>
<p>
<pre>
CPY OBJ('/QDLS/MYINFO') TODIR('/myfolder') SUBTREE(*ALL)
OWNER(*KEEP) REPLACE(*YES)
</pre>
</p>
<p>The *FLR object (QDLS file system folder) is created in the '/myfolder' directory in the "root" (/) file system with the path name '/myfolder/MYINFO'. Its contents are copied as well. Since OWNER(*KEEP) is specified, the new objects created will belong to the same profiles as the old objects. With the REPLACE parameter set to *YES if any of the target files already exist they will be overwritten.
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#COPY.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="COPY.ERROR.MESSAGES">Error messages</a> </h3>
<p><b><u>*ESCAPE Messages</u></b>
</p>
<dl>
<dt><b>CPFA082</b></dt>
<dd>*ADD authority required to owner's user profile.
</dd>
<dt><b>CPFA083</b></dt>
<dd>Insufficient authority to replace object. Object is &amp;1.
</dd>
<dt><b>CPFA085</b></dt>
<dd>Home directory not found for user &amp;1.
</dd>
<dt><b>CPFA08E</b></dt>
<dd>More than one name matches pattern.
</dd>
<dt><b>CPFA093</b></dt>
<dd>Name matching pattern not found.
</dd>
<dt><b>CPFA09C</b></dt>
<dd>Not authorized to object. Object is &amp;1.
</dd>
<dt><b>CPFA09D</b></dt>
<dd>Error occurred in program &amp;1.
</dd>
<dt><b>CPFA0A1</b></dt>
<dd>An input or output error occurred.
</dd>
<dt><b>CPFA0A3</b></dt>
<dd>Path name resolution causes looping.
</dd>
<dt><b>CPFA0A6</b></dt>
<dd>Number of links exceeds maximum allowed for the file system.
</dd>
<dt><b>CPFA0A7</b></dt>
<dd>Path name too long.
</dd>
<dt><b>CPFA0A9</b></dt>
<dd>Object not found. Object is &amp;1.
</dd>
<dt><b>CPFA0AA</b></dt>
<dd>Error occurred while attempting to obtain space.
</dd>
<dt><b>CPFA0AB</b></dt>
<dd>Operation failed for object. Object is &amp;1.
</dd>
<dt><b>CPFA0AD</b></dt>
<dd>Function not supported by file system.
</dd>
<dt><b>CPFA0B0</b></dt>
<dd>Request not allowed to operate from one file system to another.
</dd>
<dt><b>CPFA0B1</b></dt>
<dd>Requested operation not allowed. Access problem.
</dd>
<dt><b>CPFA0B2</b></dt>
<dd>No objects satisfy request.
</dd>
<dt><b>CPFA0BB</b></dt>
<dd>&amp;1 objects copied. &amp;2 objects failed.
</dd>
<dt><b>CPFA0C4</b></dt>
<dd>Object not a file. Object is &amp;1.
</dd>
<dt><b>CPFA0DA</b></dt>
<dd>Object is a directory. Object is &amp;1.
</dd>
<dt><b>CPFB41E</b></dt>
<dd>Object type must match replaced object type.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#COPY.Top_Of_Page">Top</a></td></tr>
</table>
</body>
</html>