Copying an iSeries database file that has packed

Copying an iSeries database file that has packed

Copying an iSeries database file that has packed

Copying an iSeries database file that has packed
Copying an iSeries database file that has packed

Read the Code disclaimer information for important legal information.
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 ILE C for iSeries program.

The file in this example is in library DATALIB and has the name CUSTCDT. You can refer to these example displays:

Example: DDS for iSeries database file CUSTCDT shows the DDS description of this example file, which has packed decimal fields.
If you are unfamiliar with DDS definitions, you can refer to Example: DSPFFD of iSeries database file CUSTCDT, which shows the output of the DSPFFD CUSTCDT command.
Example: Content of CUSTCDT database file display that Query for iSeries creates.
Example: DDS for logical file CUSTCDTL.
To copy the CUSTCDT database file to the QNetWare file system, you would follow these steps:

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:
To convert packed decimal fields to zoned decimal:
Create a logical file CUSTCDTL over CUSTCDT:
CUSTCDTL is the name of the logical file, and DATALIB/QDDSSRC is the source physical file that contains the member CUSTCDTL. Example: DDS for logical file CUSTCDTL shows the DDS definition of such a logical file.
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.

To redefine packed decimal fields as zoned decimal, specify S for the data type for those fields.
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.

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:
The resulting display for the example logical file CUSTCDTL shows that it has a record length of 60:

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 . . . . . . . . . . . . : 60
Create the program-described physical file:

Copy the logical file CUSTCDTL to the program-described physical file CUSTSTMF:

FMTOPT(*NOCHK) is required because the record formats of the database files are different.

Copy the program-described file CUSTSTMF into the QNetWare/SRVNW0A.SVR/SYS/DTA directory of the QNetWare file system that you created in step 1:
On the iSeries command line, type CPYTOSTMF and press F4. The Copy to Stream File (CPYTOSTMF) display appears
In the From database file member field, specify the path name of the CUSTSTMF program-described datasbase file 1 .
In the To stream file field, specify the path name of the stream file 2 .
In this case you would use the drive letter as a link to CUSTCDT.DAT.

The default value for the Data conversion option 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 *TBL and enter the table name into the TBL parameter. 3
If your database file has a CCSID of 65535, you must enter a valid CCSID code in the Database file CCSID field for your data to be correctly converted to ASCII. The values 0, 65534, and 65535 are not valid to use with this command. 4
In the Stream file code page field, specify the ASCII code page of the NetWare server to convert the data. To obtain the code page of server SRVNW0A, you would enter:
This example converts the database file data from CCSID 37 to ASCII code page 850. 5
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.
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.

Sumber :