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

424 lines
18 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 Source File (CPYSRCF)</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="CPYSRCF.Top_Of_Page"></a>
<h2>Copy Source File (CPYSRCF)</h2>
<table width="100%">
<tr>
<td valign="top" align="left"><b>Where allowed to run: </b>All environments (*ALL)<br>
<b>Threadsafe: </b>Conditional
</td>
<td valign="top" align="right">
<a href="#CPYSRCF.PARAMETERS.TABLE">Parameters</a><br>
<a href="#CPYSRCF.COMMAND.EXAMPLES">Examples</a><br>
<a href="#CPYSRCF.ERROR.MESSAGES">Error messages</a></td>
</tr>
</table>
<div> <a name="CPYSRCF"></a>
<p>The Copy Source File (CPYSRCF) command copies a database source file or DDM file to a source physical file or DDM file and converts the character data from the from-file CCSID to the to-file CCSID. If TOFILE(*PRINT) is specified, a formatted printer file is created by using the IBM-supplied printer file QSYSPRT (the file is changed for source records and is different from other copy command file formats). Any overrides issued for the from-file or to-file apply to the files used in the copy operation. Record data is copied from the from-file to the to-file, converting character data from the from-file CCSID to the to-file CCSID. Other differences in record formats (like that of the FMTOPT(*NOCHK) parameter option on the CPYF command) are disregarded.
</p>
<p>
<b>Note: </b>For more information on DDM files, see the Distributed Data Management information in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
</p>
<p>One member, all members, or a generic set of members can be copied each time the command is called. From-file members can be copied to like-named to-file members or to a single to-file member. Many members are copied and listed in alphabetical order. The to-file must exist when the CPYSRCF command is started. This command does not create the to-file, but it does add a member to an existing physical file if the member does not already exist in the to-file.
</p>
<p>This command offers a subset of the parameters available on the CPYF command. Note that the default for the MBROPT parameter is *REPLACE (unlike other copy commands), which clears existing records in the receiving member of the to-file before replacing them with records copied from the from-file. Also, the default for the TOMBR parameter is *FROMMBR, which causes from-file members to be copied to like-named to-file members.
</p>
<p><b>Restrictions:</b>
</p>
<ol>
<li>A file's open data path (ODP) cannot be shared with any other program in the job (routing step) during the copy operation.
</li>
<li>In multithreaded jobs, this command is not threadsafe when copying from or to multiple database file members, device files (except SPOOL(*YES) print files), distributed files, or DDM files of type *SNA. This command fails for distributed files that use relational databases of type *SNA and DDM files of type *SNA. It is threadsafe ONLY when copying from and to single database file members (local or DDM of type *IP) or SPOOL(*YES) print files.
</li>
</ol>
</div>
<table width="100%">
<tr><td align="right"><a href="#CPYSRCF.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div>
<h3><a name="CPYSRCF.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" rowspan="3"><a href="#CPYSRCF.FROMFILE"><b>FROMFILE</b></a></td>
<td valign="top">Data base source file</td>
<td valign="top"><i>Qualified object name</i></td>
<td valign="top" rowspan="3">Required, Positional 1</td>
</tr>
<tr>
<td valign="top">Qualifier 1: Data base source file</td>
<td valign="top"><i>Name</i></td>
</tr><tr>
<td valign="top">Qualifier 2: Library</td>
<td valign="top"><i>Name</i>, <b><u>*LIBL</u></b>, *CURLIB</td>
</tr><tr>
<td valign="top" rowspan="3"><a href="#CPYSRCF.TOFILE"><b>TOFILE</b></a></td>
<td valign="top">To file</td>
<td valign="top">Single values: *PRINT<br>Other values: <i>Qualified object name</i></td>
<td valign="top" rowspan="3">Required, Positional 2</td>
</tr>
<tr>
<td valign="top">Qualifier 1: To file</td>
<td valign="top"><i>Name</i></td>
</tr><tr>
<td valign="top">Qualifier 2: Library</td>
<td valign="top"><i>Name</i>, <b><u>*LIBL</u></b>, *CURLIB</td>
</tr><tr>
<td valign="top"><a href="#CPYSRCF.FROMMBR"><b>FROMMBR</b></a></td>
<td valign="top">From member</td>
<td valign="top"><i>Generic name, name</i>, *FIRST, *ALL</td>
<td valign="top">Required, Positional 3</td>
</tr>
<tr>
<td valign="top"><a href="#CPYSRCF.TOMBR"><b>TOMBR</b></a></td>
<td valign="top">To member or label</td>
<td valign="top"><i>Name</i>, <b><u>*FROMMBR</u></b>, *FIRST</td>
<td valign="top">Optional, Positional 4</td>
</tr>
<tr>
<td valign="top"><a href="#CPYSRCF.MBROPT"><b>MBROPT</b></a></td>
<td valign="top">Replace or add records</td>
<td valign="top"><b><u>*REPLACE</u></b>, *ADD</td>
<td valign="top">Optional, Positional 5</td>
</tr>
<tr>
<td valign="top"><a href="#CPYSRCF.SRCOPT"><b>SRCOPT</b></a></td>
<td valign="top">Source update options</td>
<td valign="top">Single values: <b><u>*SAME</u></b><br>Other values (up to 2 repetitions): *SEQNBR, *DATE</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top" rowspan="3"><a href="#CPYSRCF.SRCSEQ"><b>SRCSEQ</b></a></td>
<td valign="top">Source sequence numbering</td>
<td valign="top"><i>Element list</i></td>
<td valign="top" rowspan="3">Optional</td>
</tr>
<tr>
<td valign="top">Element 1: Starting sequence number</td>
<td valign="top">
0.01-9999.99, <b><u>1.00</u></b></td>
</tr>
<tr>
<td valign="top">Element 2: Increment number</td>
<td valign="top">
0.01-9999.99, <b><u>1.00</u></b></td>
</tr>
</table>
<table width="100%">
<tr><td align="right"><a href="#CPYSRCF.Top_Of_Page">Top</a></td></tr>
</table>
</div>
<div> <a name="CPYSRCF.FROMFILE"></a>
<h3>Data base source file (FROMFILE)</h3>
<p>Specifies the name and library of the database source file that contains the records copied.
</p>
<p>The possible library values are:
</p>
<dl>
<dt><b><u>*LIBL</u></b></dt>
<dd>All libraries in the library list for the current thread are searched until the first match is found.
</dd>
</dl>
<dl>
<dt><b>*CURLIB</b></dt>
<dd>The current library for the thread is searched. If no library is specified as the current library for the thread, the QGPL library is searched.
</dd>
</dl>
<dl>
<dt><b><i>name</i></b></dt>
<dd>Specify the name of the library to be searched.
</dd>
</dl>
<p>The possible values are:
</p>
<dl>
<dt><b><i>database-source-file-name</i></b></dt>
<dd>Specify the name of the database source file that contains records being copied.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CPYSRCF.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="CPYSRCF.TOFILE"></a>
<h3>To file (TOFILE)</h3>
<p>Specifies the file that receives the copied records.
</p>
<p>The possible values are:
</p>
<dl>
<dt><b>*PRINT</b></dt>
<dd>The records are copied to the IBM-supplied printer file QSYSPRT and listed in an SEU-type source file format. No CCSID conversions occur if *PRINT is specified. The format includes no blank lines between records, source fields separated from the data, and members listed in alphabetic order. If the listing needs to be in hexadecimal format, use the Copy File (CPYF) command with the OUTFMT(*HEX) parameter value. The IBM-supplied printer file QSYSPRT may not be overridden to a different file name, and it must have the RPLUNPRT(*YES) and CTLCHAR(*NONE) attributes.
</dd>
</dl>
<p>The possible library values are:
</p>
<dl>
<dt><b><u>*LIBL</u></b></dt>
<dd>All libraries in the library list for the current thread are searched until the first match is found.
</dd>
</dl>
<dl>
<dt><b>*CURLIB</b></dt>
<dd>The current library for the job is used to locate the source physical file. If no library is specified as the current library for the job, the QGPL library is used.
</dd>
<dt><b><i>library-name</i></b></dt>
<dd>Specify the name of the library where the source physical file is located.
</dd>
<dt><b><i>to-file-name</i></b></dt>
<dd>Specify the name of the source physical file that receives the copied records.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CPYSRCF.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="CPYSRCF.FROMMBR"></a>
<h3>From member (FROMMBR)</h3>
<p>Specifies the file member(s) copied from the from-file. A single member, a generic set of members, or all members in the from-file are copied. Members are copied and listed in alphabetical order.
</p>
<p>The possible values are:
</p>
<dl>
<dt><b>*ALL</b></dt>
<dd>All members in a database file are copied.
</dd>
</dl>
<dl>
<dt><b>*FIRST</b></dt>
<dd>The first member of the specified file is used.
</dd>
</dl>
<dl>
<dt><b><i>from-member-name</i></b></dt>
<dd>Specify the name of the database file member that is copied.
</dd>
<dt><b><i>generic*-member-name</i></b></dt>
<dd>Specify the generic name of the group of members that are copied.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CPYSRCF.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="CPYSRCF.TOMBR"></a>
<h3>Member (TOMBR)</h3>
<p>Specifies the name of the file member that receives the copied records.
</p>
<p>If *PRINT is specified for the <b>To file</b> prompt (TOFILE parameter), either *FIRST or *FROMMBR must be specified on this parameter.
</p>
<p>The possible values are:
</p>
<dl>
<dt><b><u>*FROMMBR</u></b></dt>
<dd>Corresponding from-file and to-file member names or label identifiers are used. If a member with a corresponding name does not exist in the to-file, a member with that name is added to the to-file.
<p>If a member name or *FIRST was specified as a value for the FROMMBR parameter, then a member in the to-file with the same name receives the records copied. If *ALL or a generic member name is specified as a value for the FROMMBR parameter, each member in the from-file is copied into a member with the same name in the to-file. Records from one or more members (specified by the FROMMBR parameter) in the from-file are copied to the first member in the to-file.
</p>
</dd>
</dl>
<dl>
<dt><b>*FIRST</b></dt>
<dd>The first member of the specified file is used.
</dd>
</dl>
<dl>
<dt><b><i>to-member-name</i></b></dt>
<dd>Specify the name of the physical to-file member to receive the records. If a member with the specified name does not exist, one with the same name is added.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CPYSRCF.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="CPYSRCF.MBROPT"></a>
<h3>Replace or add records (MBROPT)</h3>
<p>Specifies whether the new records replace or are added to the existing records.
</p>
<p>The possible values are:
</p>
<dl>
</dl>
<dl>
<dt><b>*REPLACE</b></dt>
<dd>The system clears the existing member and adds the new records.
</dd>
</dl>
<dl>
</dl>
<dl>
<dt><b>*ADD</b></dt>
<dd>The system adds the new records to the end of the existing records.
</dd>
</dl>
<dl>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CPYSRCF.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="CPYSRCF.SRCOPT"></a>
<h3>Source update options (SRCOPT)</h3>
<p>Specifies whether new values are assigned to the source sequence number and date fields when records from the from-file are copied to the to-file. New values can be specified in either or both fields.
</p>
<dl>
<dt><b><u>*SAME</u></b></dt>
<dd>No new values are assigned to the source sequence number and date fields.
</dd>
<dt><b>*SEQNBR</b></dt>
<dd>Sequence number and values added for the sequence number are assigned as specified in the <b>Source sequence numbering</b> prompt (SRCSEQ parameter).
</dd>
<dt><b>*DATE</b></dt>
<dd>The date fields in the records being copied are set to six zeros.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CPYSRCF.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="CPYSRCF.SRCSEQ"></a>
<h3>Source sequence numbering (SRCSEQ)</h3>
<p>Specifies, only when *SEQNBR is also specified in the <b>Source update options</b> prompt (SRCOPT parameter), the starting and end values added for creating the first and subsequent of sequence number record copied to the to-file. The value added is used to renumber all other records that are copied. The maximum value for sequence number is 9999.99; if a value is larger than this limit, additional records in the member are assigned the sequence number 9999.99.
</p>
<p>The possible values for sequence number are:
</p>
<dl>
<dt><b><u>1.00</u></b></dt>
<dd>The first source record copied to the to-file is to have a sequence number of 0001.00.
</dd>
<dt><b><i>starting-sequence-number</i></b></dt>
<dd>Specify a value in the range of 0000.01 through 9999.99 that is the sequence number of the first source record copied to the to-file.
</dd>
</dl>
<p>The possible values for <b>increment-number</b> are:
</p>
<dl>
<dt><b><u>1.00</u></b></dt>
<dd>The copied source records are renumbered in the to-file with whole number additions of 1.
</dd>
<dt><b><i>increment-number</i></b></dt>
<dd>Specify a value in the range of 0000.01 through 9999.99 that is used as the value added for renumbering all source records copied after the first record. Any value in the range of 0.01 to 9999.99 may be specified. Once the maximum sequence number of 9999.99 is reached, the sequence number of additional records is 9999.99.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CPYSRCF.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="CPYSRCF.COMMAND.EXAMPLES">Examples</a> </h3>
<p><b>Example 1: Replacing Existing Records</b>
</p>
<p>
<pre>
CPYSRCF FROMFILE(QGPL/QCLSRC) TOFILE(MYLIB/CLSRC)
FROMMBR(PGMA)
</pre>
</p>
<p>This command copies records from member PGMA of database source file QCLSRC which is in the QGPL library. The defaults for the TOMBR and MBROPT parameters are taken so the records are copied to a like-named member (PGMA) of CLSRC in library MYLIB and replaces existing records in the member. If member PGMA does not exist in the to-file, it is added as part of the copy operation. If the CCSID of QGPL/QCLSRC is different from the CCSID of MYLIB/CLSRC, the character data is converted to the CCSID of CLSRC.
</p>
<p><b>Example 2: Printing Files</b>
</p>
<p>
<pre>
CPYSRCF FROMFILE(QRPG/QRPGSRC) TOFILE(*PRINT) FROMMBR(INV*)
</pre>
</p>
<p>This command copies from database source file QRPGSRC in library QRPG, all file members whose names start with the characters INV. Special value *PRINT is specified for the to-file, so the records are copied to the printer and listed in a format tailored to source records, much like the printout created by SEU. Character data is not converted when specifying TOFILE(*PRINT).
</p>
<p><b>Example 3: Changing the Increment Value</b>
</p>
<p>
<pre>
CPYSRCF FROMFILE(MYLIB/TXTSRC) TOFILE(QIDU/QTXTSRC)
FROMMBR(*ALL) SRCOPT(*SEQNBR *DATE) SRCSEQ(1 .25)
</pre>
</p>
<p>This command copies all the members of database source file TXTSRC in library MYLIB. They are copied and replace (by using the default MBROPT(*REPLACE)) the existing records in like-named members (by using default TOMBR(*FROMMBR)) of data source file QTXTSRC in library QIDU. If the to-file members do not exist, they are added by the copy operation. For each member copied, the first record is numbered 1 and each following number is incremented by 0.25. Also, the source date field is set to zero in each record. If the CCSID of MYLIB/TXTSRC is different from the CCSID of QIDU/QTXTSRC, the character data is converted to the CCSID of QIDU/QTXTSRC.
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#CPYSRCF.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="CPYSRCF.ERROR.MESSAGES">Error messages</a> </h3>
<p><b><u>*ESCAPE Messages</u></b>
</p>
<dl>
<dt><b>CPF2816</b></dt>
<dd>File &amp;1 in &amp;2 not copied because of error.
</dd>
<dt><b>CPF2817</b></dt>
<dd>Copy command ended because of error.
</dd>
<dt><b>CPF2858</b></dt>
<dd>File attributes not valid for printed output.
</dd>
<dt><b>CPF2859</b></dt>
<dd>Shared open data path not allowed.
</dd>
<dt><b>CPF2864</b></dt>
<dd>Not authorized to file &amp;1 in library &amp;2.
</dd>
<dt><b>CPF2875</b></dt>
<dd>Wrong file member or label opened.
</dd>
<dt><b>CPF2888</b></dt>
<dd>Member &amp;3 not added to file because of error.
</dd>
<dt><b>CPF2909</b></dt>
<dd>Error clearing member &amp;3 in file &amp;1 in &amp;2.
</dd>
<dt><b>CPF2949</b></dt>
<dd>Error closing member &amp;3 in file &amp;1 in &amp;2.
</dd>
<dt><b>CPF2952</b></dt>
<dd>Error opening file &amp;1 in library &amp;2.
</dd>
<dt><b>CPF2968</b></dt>
<dd>Position error occurred copying file &amp;1 in &amp;2.
</dd>
<dt><b>CPF2971</b></dt>
<dd>Error reading member &amp;3 in file &amp;1.
</dd>
<dt><b>CPF2972</b></dt>
<dd>Error writing to member &amp;3 in file &amp;1.
</dd>
<dt><b>CPF3140</b></dt>
<dd>Initialize or copy of member &amp;2 canceled.
</dd>
<dt><b>CPF3143</b></dt>
<dd>Increments not allowed for member &amp;2.
</dd>
<dt><b>CPF3148</b></dt>
<dd>New records need too much space for member &amp;2.
</dd>
<dt><b>CPF3150</b></dt>
<dd>Data base copy failed for member &amp;2.
</dd>
<dt><b>CPF9212</b></dt>
<dd>Cannot load or unload DDM file &amp;2 in &amp;3.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CPYSRCF.Top_Of_Page">Top</a></td></tr>
</table>
</body>
</html>