172 lines
12 KiB
HTML
172 lines
12 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 xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="dc.language" scheme="rfc1766" 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. -->
|
|
<meta name="dc.date" scheme="iso8601" content="2005-09-06" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2000, 2006" />
|
|
<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="keywords" content="copy example, QNetWare file system,
|
|
MKDIR (Create Directory) command, Create Directory (MKDIR) command,
|
|
MKDIR (Create Directory), command, CL, Create Directory (MKDIR), creating,
|
|
directory, CRTLF (Create Logical File) command,
|
|
Create Logical File (CRTLF) command, CRTLF (Create Logical File),
|
|
Create Logical File (CRTLF), logical file,
|
|
DSPFD (Display File Description) command,
|
|
Display File Description (DSPFD) command, DSPFD (Display File Description),
|
|
Display File Description (DSPFD), description, displaying, files,
|
|
file description, CRTPF (Create Physical File) command,
|
|
Create Physical File (CRTPF) command, CRTPF (Create Physical File),
|
|
Create Physical File (CRTPF), physical file, CPYF (Copy File) command,
|
|
Copy File (CPYF) command, CPYF (Copy File), Copy File (CPYF), copying, file,
|
|
CPYTOSTMF (Copy To Stream File) command, Copy To Stream File (CPYTOSTMF) command,
|
|
CPYTOSTMF (Copy To Stream File), Copy To Stream File (CPYTOSTMF), to stream file,
|
|
stream file, path name, conversion, CCSID, ASCII, EBCDIC to ASCII, code page" />
|
|
<title>Example: Copying an iSeries database file that has packed decimal
|
|
fields to the QNetWare file system</title>
|
|
<link rel="stylesheet" type="text/css" href="ibmidwb.css" />
|
|
<link rel="stylesheet" type="text/css" href="ic.css" />
|
|
</head>
|
|
<body>
|
|
<a id="Top_Of_Page" name="Top_Of_Page"></a><!-- Java sync-link -->
|
|
<script language = "Javascript" src = "../rzahg/synch.js" type="text/javascript"></script>
|
|
|
|
|
|
<a name="cpydatabase"></a>
|
|
<h4 id="cpydatabase">Example: Copying an iSeries database file that has packed decimal
|
|
fields to the QNetWare file system</h4><a id="idx182" name="idx182"></a>
|
|
<a name="wq100"></a>
|
|
<div class="notetitle" id="wq100">Note:</div>
|
|
<div class="notebody">Read the <a href="rzaef02.htm#netwcodedisclaimer">Code disclaimer information</a> for important legal
|
|
information.</div>
|
|
<p>Suppose you want to make an iSeries™ database file available to all NetWare users.
|
|
If the database file is externally defined (using DDS) and has packed decimal
|
|
fields, you cannot copy it directly to a file in QNetWare file system. You need to first
|
|
copy it to a physical file; then you can copy it to a file in QNetWare. If fields
|
|
are in packed decimal format, you need to create a logical file to convert
|
|
the packed decimal fields to zoned decimal fields. The following example shows
|
|
how to copy and convert a file that contains packed decimal fields. You can
|
|
also see an example of how you might do this with an <a href="rzaefqlspgmx.htm#qlspgmx">ILE C for iSeries program</a>.</p>
|
|
<p>The file in this example is in library DATALIB and has the name CUSTCDT.
|
|
You can refer to these example displays:</p>
|
|
<ul>
|
|
<li><a href="rzaefifsql14.htm#ifsql14">Example: DDS for iSeries database file CUSTCDT</a> shows the DDS description of this example file,
|
|
which has packed decimal fields.</li>
|
|
<li>If you are unfamiliar with DDS definitions, you can refer to <a href="rzaefifsql16.htm#ifsql16">Example: DSPFFD of iSeries database file CUSTCDT</a>,
|
|
which shows the output of the <tt class="xph">DSPFFD CUSTCDT</tt> command.</li>
|
|
<li><a href="rzaefifsql15.htm#ifsql15">Example: Content of CUSTCDT database file display that Query for iSeries creates</a>.</li>
|
|
<li><a href="rzaefifsql17.htm#ifsql17">Example: DDS for logical file CUSTCDTL</a>.</li></ul>
|
|
<p>To copy the CUSTCDT database file to the QNetWare file system, you would follow these
|
|
steps: </p>
|
|
<ol type="1">
|
|
<li id="lqlscd">
|
|
<a name="lqlscd"></a>Create a directory in the QNetWare file system to use for storing iSeries database
|
|
files. For example, to create a directory on server SRVNW0A, you would enter:
|
|
<pre class="xmp"> MKDIR DIR('/QNetWare/SRVNW0A.SVR/SYS/DTA')
|
|
DTAAUT(*INDIR) OBJAUT(*INDIR) CRTOBJAUD(*NONE)</pre><a id="idx183" name="idx183"></a><a id="idx184" name="idx184"></a><a id="idx185" name="idx185"></a><a id="idx186" name="idx186"></a><a id="idx187" name="idx187"></a><a id="idx188" name="idx188"></a></li>
|
|
<li>To convert packed decimal fields to zoned decimal:
|
|
<ol type="a"><a id="idx189" name="idx189"></a><a id="idx190" name="idx190"></a><a id="idx191" name="idx191"></a><a id="idx192" name="idx192"></a><a id="idx193" name="idx193"></a><a id="idx194" name="idx194"></a>
|
|
<li>Create a logical file CUSTCDTL over CUSTCDT:
|
|
<pre class="xmp">CRTLF FILE(DATALIB/CUSTCDTL) SRCFILE(DATALIB/QDDSSRC)</pre>CUSTCDTL is the name of the logical file, and DATALIB/QDDSSRC is the
|
|
source physical file that contains the member CUSTCDTL. <a href="rzaefifsql17.htm#ifsql17">Example: DDS for logical file CUSTCDTL</a> shows
|
|
the DDS definition of such a logical file.
|
|
<p>Optionally, you can select a
|
|
subset of fields you want to copy to QNetWare. Just put the fields you need
|
|
into the logical file. You can also specify an ordering sequence on the logical
|
|
file.</p></li>
|
|
<li>To redefine packed decimal fields as zoned decimal, specify <tt class="xph">S</tt> for
|
|
the data type for those fields.
|
|
<p>There is no need to specify other field
|
|
definitions. The logical file is built over the physical file and copies all
|
|
the field definitions from it.</p></li></ol></li>
|
|
<li>After you create the logical file, you can use it to copy the data to
|
|
a program-described physical file. But first you must create the program-described
|
|
physical file. To do that, you must know the record length of the logical
|
|
file, because the program-described file must have the same record length.
|
|
You can find the record length of the logical file by using the command:
|
|
<pre class="xmp">DSPFD FILE(CUSTCDTL) TYPE(*RCDFMT)</pre>
|
|
<p>The resulting display for the example
|
|
logical file CUSTCDTL shows that it has a record length of 60: </p>
|
|
<pre class="screen"> Record Format Level
|
|
Format Fields Length Identifier
|
|
CUSREC 11 60 3B84438D4C428
|
|
Text . . . . . . . . . . . . . . . . . . . :
|
|
Total number of formats . . . . . . . . . . : 1
|
|
Total number of fields . . . . . . . . . . . : 11
|
|
Total record length . . . . . . . . . . . . : <span class="bold">60</span></pre><a id="idx195" name="idx195"></a><a id="idx196" name="idx196"></a><a id="idx197" name="idx197"></a><a id="idx198" name="idx198"></a><a id="idx199" name="idx199"></a><a id="idx200" name="idx200"></a><a id="idx201" name="idx201"></a><a id="idx202" name="idx202"></a><a id="idx203" name="idx203"></a><a id="idx204" name="idx204"></a><a id="idx205" name="idx205"></a><a id="idx206" name="idx206"></a></li>
|
|
<li>Create the program-described physical file:
|
|
<p><tt class="xph">CRTPF DATALIB/CUSTSTMF
|
|
RCDLEN(60)</tt></p></li><a id="idx207" name="idx207"></a><a id="idx208" name="idx208"></a><a id="idx209" name="idx209"></a><a id="idx210" name="idx210"></a><a id="idx211" name="idx211"></a><a id="idx212" name="idx212"></a>
|
|
<li>Copy the logical file CUSTCDTL to the program-described physical file
|
|
CUSTSTMF:
|
|
<p><tt class="xph">CPYF FROMFILE(CUSTCDTL) TOFILE(CUSTSTMF) MBROPT(*ADD) FMTOPT(*NOCHK)</tt></p>
|
|
<p>FMTOPT(*NOCHK) is required because the record formats of the
|
|
database files are different.</p></li><a id="idx213" name="idx213"></a><a id="idx214" name="idx214"></a><a id="idx215" name="idx215"></a><a id="idx216" name="idx216"></a><a id="idx217" name="idx217"></a><a id="idx218" name="idx218"></a>
|
|
<li>Copy the program-described file CUSTSTMF into the QNetWare/SRVNW0A.SVR/SYS/DTA
|
|
directory of the QNetWare file system that you created in step <a href="rzaefcpydatabase.htm#lqlscd">1</a>:
|
|
<ol type="a">
|
|
<li>On the iSeries command line, type <tt class="xph">CPYTOSTMF</tt> and press F4. The Copy
|
|
to Stream File (CPYTOSTMF) display appears, as in this example:
|
|
<pre class="screen"> Copy To Stream File (CPYTOSTMF)
|
|
|
|
Type choices, press Enter.
|
|
|
|
From database file member . . <span><span class="refkey"> 1 </span></span> > <span class="bold-italic">'/QSYS.LIB/DATALIB.LIB/CUSTSTMF.FILE
|
|
/CUSTSTMF.</span><span class="bold-italic">MBR'</span>
|
|
To stream file . . . . . . . . <span><span class="refkey"> 2 </span></span> > <span class="bold-italic">'/QNetWare/SRVNW0A.SVR/SYS/DTA/CUSTCDT.DAT'</span>
|
|
|
|
Copy options . . . . . . . . . . *NONE *NONE, *ADD, *REPLACE
|
|
Data conversion options . . . <span><span class="refkey"> 3 </span></span> *AUTO *AUTO, *TBL, *NONE
|
|
Database file CCSID . . . . . <span><span class="refkey"> 4 </span></span> > 37 1-65533, *FILE
|
|
Stream file codepage . . . . . <span><span class="refkey"> 5 </span></span> > 850 1-32767, *STMF
|
|
End of line characters . . . . . *CRLF *CRLF, *LF, *CR, *LFCR...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bottom
|
|
F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display
|
|
F24=More keys
|
|
</pre></li>
|
|
<li>In the <tt class="xph">From database file member</tt> field, specify
|
|
the path name of the CUSTSTMF program-described database file <span><span class="refkey"> 1 </span></span>.</li><a id="idx219" name="idx219"></a><a id="idx220" name="idx220"></a>
|
|
<li>In the <tt class="xph">To stream file</tt> field, specify the path name of the stream
|
|
file <span><span class="refkey"> 2 </span></span>.
|
|
<p>In this case you would use the drive letter
|
|
as a link to CUSTCDT.DAT.</p></li><a id="idx221" name="idx221"></a><a id="idx222" name="idx222"></a><a id="idx223" name="idx223"></a><a id="idx224" name="idx224"></a><a id="idx225" name="idx225"></a>
|
|
<li>The default value for the <tt class="xph">Data conversion option</tt> causes iSeries to use the coded character set identifier (CCSID) equivalent of the
|
|
stream file data code page and the database file CCSID to convert the data
|
|
during the copy operation. To use your own translation table object instead,
|
|
specify <span class="italic">*TBL</span> and enter the table name into the TBL
|
|
parameter. <span class="refkey"> 3 </span></li>
|
|
<li>If your database file has a CCSID of 65535, you must enter a valid CCSID
|
|
code in the <tt class="xph">Database file CCSID</tt> field for your data to be correctly
|
|
converted to ASCII. The values 0, 65534, and 65535 are not valid to use with
|
|
this command. <span><span class="refkey"> 4 </span></span></li>
|
|
<li>In the <tt class="xph">Stream file code page</tt> field, specify the ASCII code
|
|
page of the NetWare server to convert the data. To obtain the code page of server <tt class="xph">SRVNW0A</tt>, you would enter:
|
|
<pre class="xmp"> DSPMFSINF OBJ('/QNetWare/SRVNW0A.SVR/SYS/DTA')</pre>This example converts the database file data from CCSID 37 to ASCII
|
|
code page 850.<span><span class="refkey"> 5 </span></span></li></ol></li>
|
|
<li>Now you can access the data from a NetWare workstation. Map a drive to the
|
|
SYS volume of server SRVNW0A and then change into the DTA directory of the
|
|
mapped drive.</li>
|
|
<li>You can now look at the data in CUSTCDT.DAT (use any DOS editor), and
|
|
you will see that the file no longer contains any field information. The
|
|
application that accesses the data must know the record structure. To put
|
|
more field information into the stream file (such as a field separator character),
|
|
you must write your own program.</li></ol>
|
|
<a id="Bot_Of_Page" name="Bot_Of_Page"></a>
|
|
</body>
|
|
</html>
|