115 lines
7.7 KiB
HTML
115 lines
7.7 KiB
HTML
|
<?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="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="reference" />
|
||
|
<meta name="DC.Title" content="Copy data using CL commands" />
|
||
|
<meta name="abstract" content="There are two sets of CL commands that allow you to copy data between stream files and database file members." />
|
||
|
<meta name="description" content="There are two sets of CL commands that allow you to copy data between stream files and database file members." />
|
||
|
<meta name="DC.subject" content="stream file, copying to/from database file, database file, copying to/from stream file, creating from stream file" />
|
||
|
<meta name="keywords" content="stream file, copying to/from database file, database file, copying to/from stream file, creating from stream file" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzaaxstmpgm.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="../cl/cpytostmf.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="../cl/cpyfrmstmf.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="../cl/cpytoimpf.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="../cl/cpyfrmimpf.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="../rbam6/rbam6clmain.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1999, 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1999, 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="rzaaxcpusingcl" />
|
||
|
<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 data using CL commands</title>
|
||
|
</head>
|
||
|
<body id="rzaaxcpusingcl"><a name="rzaaxcpusingcl"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Copy data using CL commands</h1>
|
||
|
<div><p>There are two sets of CL commands that allow you to copy data between
|
||
|
stream files and database file members.</p>
|
||
|
<div class="section"><h4 class="sectiontitle"><span class="cmdname">CPYTOSTMF</span> and <span class="cmdname">CPYFRMSTMF</span> commands</h4><p>You
|
||
|
can use the <span class="cmdname">Copy from Stream File (CPYFRMSTMF)</span> and <span class="cmdname">Copy
|
||
|
to Stream File (CPYTOSTMF)</span> commands to copy data between stream
|
||
|
files and database file members. You can create a stream file from a database
|
||
|
file member by using the <span class="cmdname">CPYTOSTMF</span> command. You can also
|
||
|
create a database file member from a stream file by using the <span class="cmdname">CPYFRMSTMF</span> command.
|
||
|
If the file or member that is the target of the copy does not exist, it is
|
||
|
created.</p>
|
||
|
</div>
|
||
|
<div class="section"><p>There are some limitations, however. The database file must be
|
||
|
either a program-described physical file containing only one field or a source
|
||
|
physical file containing only one text field. The commands give you a variety
|
||
|
of options for converting and reformatting the data that is being copied.</p>
|
||
|
</div>
|
||
|
<div class="section"><p>The <span class="cmdname">CPYTOSTMF</span> and <span class="cmdname">CPYFRMSTMF</span> commands
|
||
|
can also be used to copy data between a stream file and a save file.</p>
|
||
|
</div>
|
||
|
<div class="section"><h4 class="sectiontitle"><span class="cmdname">CPYTOIMPF</span> and <span class="cmdname">CPYFRMIMPF</span> commands</h4><p>You
|
||
|
can also use the <span class="cmdname">Copy to Import File (CPYTOIMPF)</span> and <span class="cmdname">Copy
|
||
|
from Import File (CPYFRMIMPF)</span> commands to copy data between stream
|
||
|
files and database members. The <span class="cmdname">CPYTOSTMF</span> and <span class="cmdname">CPYFRMSTMF</span> commands
|
||
|
do not allow you to move data from complex, externally-described (DDS-described)
|
||
|
database files. The word <em>import file</em> refers to the stream type file;
|
||
|
the term typically refers to a file created for purposes of copying data between
|
||
|
heterogeneous databases.</p>
|
||
|
</div>
|
||
|
<div class="section"><p>When copying from a stream (or import) file, the <span class="cmdname">CPYFRMIMPF</span> command
|
||
|
allows you to specify a field definition file (FDF), which describes the data
|
||
|
in the stream file. Or, you can specify that the stream files is delimited,
|
||
|
and what characters are used to mark string, field, and record boundaries.
|
||
|
Options for converting special data types such as time and date are also provided. </p>
|
||
|
</div>
|
||
|
<div class="section"><p>Data conversion is provided on these commands if the target stream
|
||
|
file or database member already exists. If the file does not exist, you can
|
||
|
use the following two-step method to get the data converted:</p>
|
||
|
</div>
|
||
|
<div class="section"> <ol><li>Use the <span class="cmdname">CPYTOIMPF</span> and <span class="cmdname">CPYFRMIMPF</span> commands
|
||
|
to copy the data between the externally-described file and a source physical
|
||
|
file.</li>
|
||
|
<li>Use the <span class="cmdname">CPYTOSTMF</span> and <span class="cmdname">CPYFRMSTMF</span> commands
|
||
|
(which provide full data conversion regardless of whether the destination
|
||
|
file exists) to copy between the source physical file and the stream file.</li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<div class="section"><p>Here is an example:</p>
|
||
|
</div>
|
||
|
<div class="example"> <img src="./delta.gif" alt="Start of change" /><pre>CPYTOIMPF FROMFILE(DB2FILE) TOFILE(EXPFILE) DTAFMT(*DLM)
|
||
|
FLDDLM(';') RCDDLM(X'07') STRDLM(*DBLQUOTE) DATFMT(*USA) TIMFMT(*USA) </pre><img src="./deltaend.gif" alt="End of change" />
|
||
|
</div>
|
||
|
<div class="section"><p>The DTAFMT parameter specifies that the input stream (import)
|
||
|
file is delimited; the other choice is DTAFMT(*FIXED), which requires an field
|
||
|
definition file to be specified. The FLDDLM, RCDDLM and STRDLM parameters
|
||
|
identify the characters that act as the delimiters, or separators for fields,
|
||
|
records, and strings.</p>
|
||
|
</div>
|
||
|
<div class="section"><p>The DATFMT and TIMFMT parameters indicate the format for any date
|
||
|
and time information that is copied to the import file. </p>
|
||
|
</div>
|
||
|
<div class="section"><p>The commands are useful because they can be placed into a program,
|
||
|
and they run entirely on your server. However, the interfaces are complex.</p>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzaaxstmpgm.htm" title="If you are familiar with operating on database files using record-oriented facilities such as data description specifications (DDS), you may find some fundamental differences in the way you operate on stream files.">Copy data between stream files and database files</a></div>
|
||
|
</div>
|
||
|
<div class="relinfo"><strong>Related information</strong><br />
|
||
|
<div><a href="../cl/cpytostmf.htm">Copy to Stream File (CPYTOSTMF) command</a></div>
|
||
|
<div><a href="../cl/cpyfrmstmf.htm">Copy from Stream File (CPYFRMSTMF) command</a></div>
|
||
|
<div><a href="../cl/cpytoimpf.htm">Copy to Import File (CPYTOIMPF) command</a></div>
|
||
|
<div><a href="../cl/cpyfrmimpf.htm">Copy from Import File (CPYFRMIMPF) command</a></div>
|
||
|
<div><a href="../rbam6/rbam6clmain.htm">Control language (CL)</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|