219 lines
17 KiB
HTML
219 lines
17 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="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="Copying between different database record formats (FMTOPT parameter)" />
|
||
|
<meta name="abstract" content="When you copy from a database file to a database file, you must use the FMTOPT parameter if the record formats are not identical or if the files are different types (source or data). If either file is a device file or inline data file, the FMTOPT parameter does not apply. The records are truncated or padded with blanks or zeros when record lengths are different. A message is sent if the records are truncated." />
|
||
|
<meta name="description" content="When you copy from a database file to a database file, you must use the FMTOPT parameter if the record formats are not identical or if the files are different types (source or data). If either file is a device file or inline data file, the FMTOPT parameter does not apply. The records are truncated or padded with blanks or zeros when record lengths are different. A message is sent if the records are truncated." />
|
||
|
<meta name="DC.subject" content="Copy File (CPYF) command, copying between different database record formats, CPYF (Copy File) command, copying between different database record formats, copy command, copying between different database record formats, record format, copying between, FMTOPT (record format field mapping) parameter, copying file, selecting records, compressing deleted records, deleted record, compressing, dropping fields, copying files, default (DFT) keyword, for physical files, physical file, default (DFT) keyword, record, deleted, dropping fields, mapping, fields, dropping fields, copying files, database file record formats, copy operation, database to database, FMTOPT parameter values, field mapping (FMTOPT) parameter" />
|
||
|
<meta name="keywords" content="Copy File (CPYF) command, copying between different database record formats, CPYF (Copy File) command, copying between different database record formats, copy command, copying between different database record formats, record format, copying between, FMTOPT (record format field mapping) parameter, copying file, selecting records, compressing deleted records, deleted record, compressing, dropping fields, copying files, default (DFT) keyword, for physical files, physical file, default (DFT) keyword, record, deleted, dropping fields, mapping, fields, dropping fields, copying files, database file record formats, copy operation, database to database, FMTOPT parameter values, field mapping (FMTOPT) parameter" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbal3copyfile.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbal3specdata.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbal3ucs2.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbal3cucc.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbal3s370.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbal3convr.htm" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="rbal3copydbmbrfmt" />
|
||
|
<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> Copying between different database record formats (FMTOPT parameter)</title>
|
||
|
</head>
|
||
|
<body id="rbal3copydbmbrfmt"><a name="rbal3copydbmbrfmt"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1"> Copying between different database record formats (FMTOPT parameter)</h1>
|
||
|
<div><p>When you copy from a database file to a database file, you must
|
||
|
use the FMTOPT parameter if the record formats are not identical or if the
|
||
|
files are different types (source or data). If either file is a device file
|
||
|
or inline data file, the FMTOPT parameter does not apply. The records are
|
||
|
truncated or padded with blanks or zeros when record lengths are different.
|
||
|
A message is sent if the records are truncated.</p>
|
||
|
<div class="note"><span class="notetitle">Note:</span> You can use this parameter on the <a href="../cl/cpyf.htm">CPYF</a> and <a href="../cl/cpyfrmqryf.htm">CPYFRMQRYF</a> commands.</div>
|
||
|
<p>For database files, when either FMTOPT(*CVTSRC) or FMTOPT(*NOCHK) is specified
|
||
|
and the record data copied from any from-file record is not long enough to
|
||
|
fill a to-file record, the extra bytes in the to-file record are set to a
|
||
|
default value. If a default value other than *NULL is specified in the DDS
|
||
|
(DFT keyword) for a field, that field is initialized to the specified default;
|
||
|
otherwise, all numeric fields are initialized to zeros, all character fields
|
||
|
are initialized to blanks, all date, time, and timestamp fields are initialized
|
||
|
to the current server date and time. If *NULL is specified on the DFT keyword,
|
||
|
only the default buffer value is used. A *NULL default is ignored.</p>
|
||
|
<p>If the from-file or to-file is a device file or an inline data file, copy
|
||
|
automatically adds or deletes the source sequence number and date fields for
|
||
|
each record copied.</p>
|
||
|
<p>If one file is a data file and the other a source file, you must specify
|
||
|
FMTOPT(*CVTSRC) to perform the copy. The sequence number and date fields are
|
||
|
added or deleted as appropriate and the data part of each record is copied
|
||
|
without regard to the other field definitions in the file record formats.
|
||
|
The SRCSEQ parameter can be used to control how the sequence numbers are created,
|
||
|
provided SRCOPT(*SEQNBR) is also specified.</p>
|
||
|
<p>Binary character fields are padded with zeros when using FMTOPT *MAP.</p>
|
||
|
<div class="p">For database-to-database copies, you can reconcile any differences in record
|
||
|
formats by specifying: <ul><li>*DROP to drop those fields in the from-file record format for which there
|
||
|
are no fields of the same name in the to-file record format.</li>
|
||
|
<li>*MAP to convert fields in the from-file to the attributes of like-named
|
||
|
fields in the to-file and to fill extra fields in the to-file, that are not
|
||
|
in the from-file, with their default values. The default values are: <ul><li>The parameter value (including *NULL) for the DFT keyword, if specified
|
||
|
for the field</li>
|
||
|
<li>Blanks (for character fields without the DFT keyword)</li>
|
||
|
<li>Zeros (for numeric fields without the DFT keyword)</li>
|
||
|
<li>Current date, time, or timestamp for those type fields without
|
||
|
the DFT keyword</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div class="p">*MAP is required if fields with the same name are in different positions
|
||
|
in the file record formats, even though these fields have the same attributes. <ul><li>*DROP and *MAP to drop fields in the from-file not named in the to-file
|
||
|
and to convert remaining fields through mapping rules to fit the to-file fields
|
||
|
that have different attributes or positions.</li>
|
||
|
<li>*NOCHK to disregard the differences. Data is copied left to right directly
|
||
|
from one file to the other. Null values are ignored. The copied records are
|
||
|
either truncated or padded with default buffer values. Because no checking
|
||
|
is done, fields in the to-file might contain data that is not valid for the
|
||
|
field as defined.</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<p>Dropping and mapping fields are based on a comparison of field names. Unless
|
||
|
all the fields in the from-file have the same name in the to-file, you must
|
||
|
specify *DROP. If the names are the same, but the attributes or position in
|
||
|
the record is different, you must specify *MAP. Dropped fields are not copied.
|
||
|
There must be at least one like-named field in both record formats to do mapping.</p>
|
||
|
<p>When *MAP is specified, fields in the to-file record format that do not
|
||
|
exist in the from-file record format are filled with their default values,
|
||
|
as described earlier in this section. For fields that have the same name and
|
||
|
attributes, the field in the from-file record format is mapped to the field
|
||
|
with the same name in the to-file record format, even if their positions in
|
||
|
the formats are different.</p>
|
||
|
<p>For example, the field CUSNO is the first field in the record format ORDHD,
|
||
|
but it is the second field in record format ORDHD1. When the CUSNO field is
|
||
|
copied with *MAP, it is mapped to the second field of ORDHD1.</p>
|
||
|
<div class="note"><span class="notetitle">Note:</span> It is possible for files with large record formats (many fields) to
|
||
|
have the same format level identifiers even though their formats might be
|
||
|
slightly different. Problems can occur when copying these files if the record
|
||
|
format names of the from-file and the to-file are the same. When copying such
|
||
|
files using FMTOPT(*NONE) or FMTOPT(*MAP), it is recommended that the record
|
||
|
format names of the from-file and the to-file be different.</div>
|
||
|
<p><a href="#rbal3copydbmbrfmt__rbal3fmt">Table 1</a> summarizes the database-to-database
|
||
|
copy operations for each value on the FMTOPT parameter.</p>
|
||
|
|
||
|
<div class="tablenoborder"><a name="rbal3copydbmbrfmt__rbal3fmt"><!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="rbal3copydbmbrfmt__rbal3fmt" width="100%" frame="border" border="1" rules="all"><caption>Table 1. Database-to-Database copy operations</caption><thead align="left"><tr><th rowspan="2" align="left" valign="top" width="9.62962962962963%" id="d0e147">FMTOPT parameter values (see
|
||
|
note 4)</th>
|
||
|
<th colspan="5" align="center" valign="top" id="d0e149">Database file
|
||
|
record formats</th>
|
||
|
</tr>
|
||
|
<tr><th align="left" valign="top" width="23.703703703703706%" id="d0e152"> All field names in From-and To-Files are
|
||
|
the same (like-named)</th>
|
||
|
<th align="left" valign="top" width="23.14814814814815%" id="d0e154"> Some field names in From-and To-Files are
|
||
|
the same</th>
|
||
|
<th colspan="3" align="left" valign="top" id="d0e156"> No field names
|
||
|
in either file are the same</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody><tr><td valign="top" width="9.62962962962963%" headers="d0e147 "> </td>
|
||
|
<td align="left" valign="top" headers="d0e149 d0e152 ">Attributes and relative order
|
||
|
also the same (see note 1)</td>
|
||
|
<td align="left" valign="top" width="23.14814814814815%" headers="d0e149 d0e154 ">Attributes and relative order not the same
|
||
|
(see note 1)</td>
|
||
|
<td align="left" valign="top" width="15.185185185185185%" headers="d0e149 d0e156 ">Like-named fields have identical attributes
|
||
|
and relative order (see note 1)</td>
|
||
|
<td align="left" valign="top" width="15.185185185185185%" headers="d0e149 d0e156 ">Not all like-named fields have identical
|
||
|
attributes and relative order (see note 1)</td>
|
||
|
<td valign="top" width="13.148148148148147%" headers="d0e149 d0e156 "> </td>
|
||
|
</tr>
|
||
|
<tr><td align="left" valign="top" width="9.62962962962963%" headers="d0e147 ">*NONE</td>
|
||
|
<td align="left" valign="top" width="23.703703703703706%" headers="d0e149 d0e152 ">Complete copy</td>
|
||
|
<td align="left" valign="top" width="23.14814814814815%" headers="d0e149 d0e154 ">Command ends</td>
|
||
|
<td align="left" valign="top" width="15.185185185185185%" headers="d0e149 d0e156 ">Command ends</td>
|
||
|
<td align="left" valign="top" width="15.185185185185185%" headers="d0e149 d0e156 ">Command ends</td>
|
||
|
<td align="left" valign="top" width="13.148148148148147%" headers="d0e149 d0e156 ">Command ends</td>
|
||
|
</tr>
|
||
|
<tr><td align="left" valign="top" width="9.62962962962963%" headers="d0e147 ">*DROP</td>
|
||
|
<td align="left" valign="top" width="23.703703703703706%" headers="d0e149 d0e152 ">Complete copy (value ignored)</td>
|
||
|
<td align="left" valign="top" width="23.14814814814815%" headers="d0e149 d0e154 ">Command ends</td>
|
||
|
<td align="left" valign="top" width="15.185185185185185%" headers="d0e149 d0e156 ">If there are extra fields in the from-file,
|
||
|
they are dropped, all others are copied. If there are extra fields in the
|
||
|
to-file, the command ends. If there are extra fields in the from-file and
|
||
|
in the to-file, the command ends.</td>
|
||
|
<td align="left" valign="top" width="15.185185185185185%" headers="d0e149 d0e156 ">Command ends</td>
|
||
|
<td align="left" valign="top" width="13.148148148148147%" headers="d0e149 d0e156 ">Command ends</td>
|
||
|
</tr>
|
||
|
<tr><td align="left" valign="top" width="9.62962962962963%" headers="d0e147 ">*MAP (see note 2)</td>
|
||
|
<td align="left" valign="top" width="23.703703703703706%" headers="d0e149 d0e152 ">Complete copy (value ignored)</td>
|
||
|
<td align="left" valign="top" width="23.14814814814815%" headers="d0e149 d0e154 ">Complete copy (corresponding fields are mapped)</td>
|
||
|
<td colspan="2" align="left" valign="top" headers="d0e149 d0e156 ">If there are
|
||
|
extra fields in the from-file, the command ends. If there are extra fields
|
||
|
in the to-file, they are filled, and the like-named fields are mapped. If
|
||
|
there are extra fields in the to-file and the from-file, the command ends.</td>
|
||
|
<td align="left" valign="top" width="13.148148148148147%" headers="d0e149 d0e156 ">Command ends</td>
|
||
|
</tr>
|
||
|
<tr><td align="left" valign="top" width="9.62962962962963%" headers="d0e147 ">*MAP and *DROP (see note 2)</td>
|
||
|
<td align="left" valign="top" width="23.703703703703706%" headers="d0e149 d0e152 ">Complete copy (value ignored)</td>
|
||
|
<td align="left" valign="top" width="23.14814814814815%" headers="d0e149 d0e154 ">Complete copy (corresponding fields are mapped)</td>
|
||
|
<td colspan="2" align="left" valign="top" headers="d0e149 d0e156 ">Extra fields
|
||
|
in the from-file are dropped; like-named fields are mapped; extra fields in
|
||
|
the to-file are filled.</td>
|
||
|
<td align="left" valign="top" width="13.148148148148147%" headers="d0e149 d0e156 ">Command ends</td>
|
||
|
</tr>
|
||
|
<tr><td align="left" valign="top" width="9.62962962962963%" headers="d0e147 ">*NOCHK</td>
|
||
|
<td align="left" valign="top" width="23.703703703703706%" headers="d0e149 d0e152 ">Complete copy (value ignored)</td>
|
||
|
<td colspan="4" align="left" valign="top" headers="d0e149 d0e154 d0e156 ">Complete copy
|
||
|
(direct data transfer disregarding fields) (see note 3)</td>
|
||
|
</tr>
|
||
|
<tr><td colspan="6" align="left" valign="top" headers="d0e147 d0e149 d0e152 d0e154 d0e156 "> <div class="note"><span class="notetitle">Notes:</span> <ol><li>Field attributes include the data type (character, zoned, packed, binary
|
||
|
or floating point), field length, decimal position (for numeric fields), date
|
||
|
or time format (for date or time fields), null capability, CCSID, and whether
|
||
|
the field has variable length or fixed length.</li>
|
||
|
<li>Mapping consists of converting the data in a from-file field to the attributes
|
||
|
of the corresponding (like-named) to-file field. If the attributes of any
|
||
|
corresponding fields are such that the data cannot be converted, the copy
|
||
|
is ended.</li>
|
||
|
<li>The records are padded or truncated as necessary. Data in the from-file
|
||
|
might not match the to-file record format.</li>
|
||
|
<li>Any other value specified for the FMTOPT parameter is ignored when the
|
||
|
*CVTFLOAT value or the *NULLFLAGS value is specified (except the *CVTFLOAT
|
||
|
and *NULLFLAGS values).</li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<ul class="ullinks">
|
||
|
<li class="ulchildlink"><strong><a href="rbal3specdata.htm">Specify data for different field types and attributes</a></strong><br />
|
||
|
You can use FMTOPT(*MAP) to map data between fixed-length and variable-length fields and between variable-length fields with different maximum lengths.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbal3ucs2.htm">Convert universal coded character set (UCS-2) graphic fields</a></strong><br />
|
||
|
You use FMTOPT(*MAP) to convert universal coded character set (UCS-2) graphic fields.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbal3cucc.htm">Convert universal coded character set transformation format (UTF-8 character & UTF-16 graphic)</a></strong><br />
|
||
|
</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbal3s370.htm">Convert System/370 floating point and null fields</a></strong><br />
|
||
|
To copy floating point fields and null fields that are in a System/370™ format
|
||
|
to an <span class="keyword">iSeries™</span> format, use FMTOPT(*CVTFLOAT)
|
||
|
for the floating point fields and FMTOPT(*NULLFLAGS) for the null fields.
|
||
|
You can use these two values together in one command: FMTOPT(*CVTFLOAT *NULLFLAGS).</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbal3convr.htm">Conversion rules for copying files</a></strong><br />
|
||
|
</li>
|
||
|
</ul>
|
||
|
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbal3copyfile.htm" title="The copy function on iSeries can copy physical and logical files, copy members and records, copy complex objects, and copy files between servers.">Copy files</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|