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

403 lines
19 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 From Stream File (CPYFRMSTMF)</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="CPYFRMSTMF.Top_Of_Page"></a>
<h2>Copy From Stream File (CPYFRMSTMF)</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="#CPYFRMSTMF.PARAMETERS.TABLE">Parameters</a><br>
<a href="#CPYFRMSTMF.COMMAND.EXAMPLES">Examples</a><br>
<a href="#CPYFRMSTMF.ERROR.MESSAGES">Error messages</a></td>
</tr>
</table>
<div> <a name="CPYFRMSTMF"></a>
<p>The Copy From Stream File (CPYFRMSTMF) command copies the data in a stream file to either a database file member or a save file. Optional conversion of the data and reformatting is performed when copying a database file member. This command cannot be used to copy to or from a database file member on a remote system. Any overrides in effect for the database file member or the save file are not used by this command.
</p>
<p>This command can operate on regular files and on the /dev/null character special file. A regular file is a file that supports the integrated file system input/output (I/O) operations open, read, and write.
</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>Note: </b>The sequence numbers in the resulting database file member may be out of order. If a function will be used that requires the sequence numbers to be ordered, use the Reorganize Physical File Member (RGZPFM) command on the member, with the SRCOPT(*SEQNBR) parameter specified.
</p>
<p><b>Restrictions:</b>
</p>
<ol>
<li>The database-member-path-name must be of the form <b>name.object-type</b>. For example, <b>/QSYS.LIB/LIBA.LIB/FILEA.FILE/MBRA.MBR</b> is the form required by the QSYS.LIB file system.
</li>
<li>The save-file-path-name must be of the form <b>name.object-type</b>. For example, <b>/QSYS.LIB/LIBA.LIB/SAVEFILEA.FILE</b> is the form required by the QSYS.LIB file system.
</li>
<li>The following authorities are required:
<ul>
<li>Execute (*X) authority to directories in the path name prefix of the database file, save file, stream file or conversion table.
</li>
<li>Read (*R) authority to the stream file.
</li>
<li>One of the following authorities to the database file:
<ul>
<li>*X and add (*ADD) to do MBROPT(*ADD)
</li>
<li>*X, object management (*OBJMGT), *ADD, and delete (*DLT) to do MBROPT(*REPLACE)
</li>
</ul>
</li>
<li>If a new member is created in the database file, the following authorities are required:
<ul>
<li>*X, *OBJMGT, and *ADD to the database file.
</li>
<li>*X and *ADD to the directory containing the database file.
</li>
</ul>
</li>
<li>Read, execute (*RX), *OBJMGT, and *ADD to the save file if the save file already exists.
</li>
<li>*RX and *ADD to the save file's parent directory if the save file does not already exist.
</li>
<li>If a conversion table was specified, object operational (*OBJOPR) to the conversion table.
</li>
</ul>
</li>
</ol>
</div>
<table width="100%">
<tr><td align="right"><a href="#CPYFRMSTMF.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div>
<h3><a name="CPYFRMSTMF.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="#CPYFRMSTMF.FROMSTMF"><b>FROMSTMF</b></a></td>
<td valign="top">From stream file</td>
<td valign="top"><i>Path name</i></td>
<td valign="top">Required, Positional 1</td>
</tr>
<tr>
<td valign="top"><a href="#CPYFRMSTMF.TOMBR"><b>TOMBR</b></a></td>
<td valign="top">To file member or save file</td>
<td valign="top"><i>Path name</i></td>
<td valign="top">Required, Positional 2</td>
</tr>
<tr>
<td valign="top"><a href="#CPYFRMSTMF.MBROPT"><b>MBROPT</b></a></td>
<td valign="top">Member option</td>
<td valign="top"><b><u>*NONE</u></b>, *ADD, *REPLACE</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#CPYFRMSTMF.CVTDTA"><b>CVTDTA</b></a></td>
<td valign="top">Data conversion options</td>
<td valign="top"><b><u>*AUTO</u></b>, *TBL, *NONE</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#CPYFRMSTMF.STMFCODPAG"><b>STMFCODPAG</b></a></td>
<td valign="top">Stream file code page</td>
<td valign="top">1-32767, <b><u>*STMF</u></b>, *PCASCII</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#CPYFRMSTMF.DBFCCSID"><b>DBFCCSID</b></a></td>
<td valign="top">Database file CCSID</td>
<td valign="top">1-65533, <b><u>*FILE</u></b></td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#CPYFRMSTMF.TBL"><b>TBL</b></a></td>
<td valign="top">Conversion table</td>
<td valign="top"><i>Path name</i></td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#CPYFRMSTMF.ENDLINFMT"><b>ENDLINFMT</b></a></td>
<td valign="top">End of line characters</td>
<td valign="top"><b><u>*ALL</u></b>, *CRLF, *LF, *CR, *LFCR, *FIXED</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#CPYFRMSTMF.TABEXPN"><b>TABEXPN</b></a></td>
<td valign="top">Tab character expansion</td>
<td valign="top"><b><u>*YES</u></b>, *NO</td>
<td valign="top">Optional</td>
</tr>
</table>
<table width="100%">
<tr><td align="right"><a href="#CPYFRMSTMF.Top_Of_Page">Top</a></td></tr>
</table>
</div>
<div> <a name="CPYFRMSTMF.FROMSTMF"></a>
<h3>From stream file (FROMSTMF)</h3>
<p>Specifies the path name of the stream file from which data is copied. This command can operate on files of type *STMF and on the /dev/null character special file.
</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="#CPYFRMSTMF.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="CPYFRMSTMF.TOMBR"></a>
<h3>To file member or save file (TOMBR)</h3>
<p>Specifies the path name of the database file member or save file to which data is copied. All directories in the path name must exist.
</p>
<p>When copying to a save file, the save file will be created if it does not exist.
</p>
<p>When copying to a database file member, the database file must exist. If the member does not exist, it is created. The file may be either a source physical file or a program-described physical file. Source physical files with multiple data fields are not supported.
</p>
<p>If the database file is a source physical file, a sequence number and a date stamp of zeros is added to each record as it is copied to the database file member.
</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="#CPYFRMSTMF.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="CPYFRMSTMF.MBROPT"></a>
<h3>Member option (MBROPT)</h3>
<p>Specifies whether the copy operation replaces, adds, or fails to copy the records if the object specified on the <b>To file member or save file (TOMBR)</b> parameter already exists. If the object does not exist, it is created.
</p>
<dl>
<dt><b><u>*NONE</u></b></dt>
<dd>No records are copied and the operation will fail if the object exists.
</dd>
<dt><b>*ADD</b></dt>
<dd>The copied records are added to the end of the existing records.
</dd>
<dt><b>*REPLACE</b></dt>
<dd>The copied records replace the existing records.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CPYFRMSTMF.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="CPYFRMSTMF.CVTDTA"></a>
<h3>Data conversion options (CVTDTA)</h3>
<p>Specifies the process for converting the data from the stream file to the database file member.
</p>
<p>This parameter is ignored when copying to a save file.
</p>
<dl>
<dt><b><u>*AUTO</u></b></dt>
<dd>The data is converted during the copy operation using the coded character set identifier (CCSID) of the stream file and the database file CCSID. Single-byte, double-byte and mixed character sets are supported. The stream file data code page must be specified on the <b>Stream file code page (STMFCODPAG)</b> parameter, and the database file CCSID must be specified on the <b>Database file CCSID (DBFCCSID)</b> parameter.
</dd>
<dt><b>*TBL</b></dt>
<dd>The data is converted using a conversion table. Only single-byte character sets are supported. The conversion table must be specified on the <b>Conversion table (TBL)</b> parameter.
</dd>
<dt><b>*NONE</b></dt>
<dd>Only insertion of the sequence numbers and date stamp to source physical files and the optional removal of specified line-formatting characters from the stream file are performed. Stream file code page to database file CCSID conversion of other characters is not performed.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CPYFRMSTMF.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="CPYFRMSTMF.STMFCODPAG"></a>
<h3>Stream file code page (STMFCODPAG)</h3>
<p>Specifies the method of obtaining the stream file code page.
</p>
<p>This parameter is ignored when copying to a save file.
</p>
<dl>
<dt><b><u>*STMF</u></b></dt>
<dd>The code page associated with the stream file is used.
</dd>
<dt><b>*PCASCII</b></dt>
<dd>Use the code page associated with the file to be copied from 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). This code page is used if data conversion is requested. This option allows data to be converted properly if the data was created using Microsoft Windows.
<p>For example, if the code page associated with the stream file is 37, the stream file data is instead assumed to be in code page 1252 for data conversion.
</p>
</dd>
<dt><b><i>1-32767</i></b></dt>
<dd>Specify the stream file code page.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CPYFRMSTMF.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="CPYFRMSTMF.DBFCCSID"></a>
<h3>Database file CCSID (DBFCCSID)</h3>
<p>Specifies the method of obtaining the database file CCSID.
</p>
<p>This parameter is ignored when copying to a save file.
</p>
<dl>
<dt><b><u>*FILE</u></b></dt>
<dd>The database file CCSID is used, unless it is 65535. If the database file CCSID is 65535, and the file is not a program-described file, the operation will fail. If the database file CCSID is 65535, and the file is a program-described file, the default job CCSID is used.
</dd>
<dt><b><i>1-65533</i></b></dt>
<dd>Specify the database file coded character set identifier (CCSID). This option is valid only if the database file CCSID is 65535 or is the same as the CCSID specified. Otherwise, the operation will fail.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CPYFRMSTMF.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="CPYFRMSTMF.TBL"></a>
<h3>Conversion table (TBL)</h3>
<p>Specifies the path name of the conversion table to be used to convert data from the stream file to the database file member.
</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>This parameter is required and valid only if CVTDTA(*TBL) is specified. This parameter is ignored when copying to a save file.
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#CPYFRMSTMF.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="CPYFRMSTMF.ENDLINFMT"></a>
<h3>End of line characters (ENDLINFMT)</h3>
<p>Specifies the end-of-line characters which are recognized in the stream file during copying of records.
</p>
<p>This parameter is ignored when copying to a save file.
</p>
<p>All records are transformed to a fixed-length format as they are copied to the database file. The fixed-length is equal to the length of the database file records to which they are copied. If one of the end-of-line character options is selected (ENDLINFMT(*FIXED) is not specified) the stream file is read up to first occurrence of that character. The end-of-line character is stripped from the record. The remainder of the record is padded with blanks. The data is converted to the destination data format (if specified) and copied to the database file member. If a record is too long to fit in the fixed-length format, it is truncated, then copied.
</p>
<dl>
<dt><b><u>*ALL</u></b></dt>
<dd>Any single or double character combination of carriage-return and line-feed is appended to the end of each line.
</dd>
<dt><b>*CRLF</b></dt>
<dd>Carriage-return followed by line-feed is appended to the end of each line.
</dd>
<dt><b>*LF</b></dt>
<dd>Line-feed is appended to the end of each line.
</dd>
<dt><b>*CR</b></dt>
<dd>Carriage-return is appended to the end of each line.
</dd>
<dt><b>*LFCR</b></dt>
<dd>Line-feed followed by carriage-return is appended to the end of each line.
</dd>
<dt><b>*FIXED</b></dt>
<dd>Text lines in the stream file are considered fixed-length records of the same length as the database file records to which they are to be copied. Any encountered CR, LF, or EOF characters are not stripped from the stream file. Tab expansion is not allowed and the <b>Tab character expansion (TABEXPN)</b> parameter is not valid. If the last record in the stream file does not fill the database file record, that record is padded with blanks.
<p>Only stream files and database files with compatible encoding schemes, which do not result in the expansion of data record lengths, are valid with this option. If an incompatible encoding scheme combination is detected, the operation will fail.
</p>
<p>The following encoding scheme combinations are supported:
</p>
<ul>
<li>Single-byte to single-byte
</li>
<li>Double-byte to double-byte
</li>
<li>Mixed ASCII to mixed ASCII
</li>
<li>Mixed EBCDIC to mixed EBCDIC
</li>
</ul>
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CPYFRMSTMF.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="CPYFRMSTMF.TABEXPN"></a>
<h3>Tab character expansion (TABEXPN)</h3>
<p>Specifies whether embedded tab characters are expanded to blanks up to the next eight-character tab position.
</p>
<p>This parameter is ignored when copying to a save file.
</p>
<dl>
<dt><b><u>*YES</u></b></dt>
<dd>Tab characters are not copied to the database file member. Any encountered tab character is expanded with blanks up to the next tab position.
<p>
<b>Note: </b>If ENDLINFMT(*FIXED) is specified, *YES is not a valid value for this parameter.
</p>
</dd>
<dt><b>*NO</b></dt>
<dd>Tab characters are copied to the database file member. No tab expansion occurs.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CPYFRMSTMF.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="CPYFRMSTMF.COMMAND.EXAMPLES">Examples</a> </h3>
<p><b>Example 1: Copying Data from a Stream File to a Database File Using Automatic Conversion</b>
</p>
<p>
<pre>
CPYFRMSTMF FROMSTMF('STMF.TXT')
TOMBR('/QSYS.LIB/MYLIB.LIB/MYFILE.FILE/MYMBR.MBR')
</pre>
</p>
<p>This command copies the data contained in stream file STMF.TXT in the current working directory to database file member /QSYS.LIB/MYLIB.LIB/MYFILE.FILE/MYMBR.MBR. Automatic conversion of data takes place using the stream file data code page and the database file CCSID. Any single-byte or double-byte character combination of CR and LF will be recognized as the end of a line in the stream file, and any embedded tabs are expanded with blanks out to the next tab position since these are the default values. If member MYMBR.MBR does not exist in the file, it is created. If member MYMBR.MBR exists, no records are copied since MBROPT(*NONE) is the default value.
</p>
<p><b>Example 2: Copying Data from a Stream File to a Database File Using a Conversion Table</b>
</p>
<p>
<pre>
CPYFRMSTMF FROMSTMF('FINANCE.NEW')
TOMBR('/QSYS.LIB/FINANCE.LIB/STAFF.FILE/MNGR.MBR')
CVTDTA(*TBL) STMFCODPAG(437)
TBL('/QSYS.LIB/QUSRSYS.LIB/TBL1.TBL')
ENDLINFMT(*CRLF) TABEXPN(*NO)
</pre>
</p>
<p>This command copies the data in stream file FINANCE.NEW in the current working directory to the database file member /QSYS.LIB/FINANCE.LIB/STAFF.FILE/MNGR.MBR. The data in the stream file is converted using the user-specified conversion table TBL1.TBL contained in the directory /QSYS.LIB/QUSRSYS.LIB. The double character combination of CR and LF is recognized as the end of a stream file line. Any embedded tabs are not expanded with blanks. The line-formatting characters are recognized from code page 437 specified on the STMFCODPAG parameter.
</p>
<p><b>Example 3: Copying Data from a Stream File to a Data-base File Without Data Conversion</b>
</p>
<p>
<pre>
CPYFRMSTMF FROMSTMF('FINANCE.NEW')
TOMBR('/QSYS.LIB/FINANCE.LIB/STAFF.FILE/MNGR.MBR')
CVTDTA(*NONE) ENDLINFMT(*FIXED)
</pre>
</p>
<p>This command copies the data in stream file 'FINANCE.NEW' in the current working directory to the database file member /QSYS.LIB/FINANCE.LIB/STAFF.FILE/MNGR.MBR without data conversion. The stream file data lines are considered to be fixed length records of the same length as the database file records. Because TABEXPN(*NO) is specified, any tab characters encountered are not expanded to blanks during copying. If the encoding scheme of the stream file and the database file differ, the copy ends with an error message.
</p>
<p><b>Example 4: Copying Data from a Stream File to a Save File</b>
</p>
<p>
<pre>
CPYFRMSTMF FROMSTMF('/MYDIR/SOFTWARE')
TOMBR('/QSYS.LIB/PACKAGE.LIB/SOFTWARE.FILE')
</pre>
</p>
<p>This command copies the data contained in stream file /MYDIR/SOFTWARE to the save file /QSYS.LIB/PACKAGE.LIB/SOFTWARE.FILE. The stream file data is copied as fixed-length records with length of 528. No line-formatting characters are inserted, nor is any data conversion performed.
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#CPYFRMSTMF.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="CPYFRMSTMF.ERROR.MESSAGES">Error messages</a> </h3>
<p><b><u>*ESCAPE Messages</u></b>
</p>
<dl>
<dt><b>CPFA085</b></dt>
<dd>Home directory not found for user &amp;1.
</dd>
<dt><b>CPFA095</b></dt>
<dd>Stream file not copied.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CPYFRMSTMF.Top_Of_Page">Top</a></td></tr>
</table>
</body>
</html>