 |
 |
| iSeries 400 Tips: |
|
 |
 |

ISERIES ADMINISTRATOR TIPS
How to save time using the CPYTOPCD and CPYFRMPCD commands
Ron Turull 10.27.2004
Rating: -3.64- (out of 5)




[TABLE]The Copy To PC Document (CPYTOPCD) and the Copy From PC Document (CPYFRMPCD) commands are real time-savers for copying iSeries physical file members to and from PC text files (i.e., PC documents). These commands provide a two-way data conversion utility between the iSeries and PC via the shared folders system on the iSeries (also called the DLO and DLS systems).
The prompted CPYTOPCD command is shown below. (The CPYFRMPCD command is very similar.)
[TABLE]The translate table parameter
Of particular interest is the Translate Table parameter (TRNTBL keyword). The Translate Table parameter specifies the name of the translation table object (object type *TBL) to use for converting the data. As you are aware, the PC uses ASCII data encoding while the iSeries uses EBCDIC. When you specify the default value of *DFT for the translate table parameter, the CPYTOPCD command will use the system default EBCDIC-to-ASCII table and the CPYFRMPCD will use the system default ASCII-to-EBCDIC table.
The special value *NONE can be used if no data translation is required. This is useful when you need to copy a physical file from one iSeries to another with dissimilar media types (via e-mail or PC media). For example, use the CPYTOPCD command with TRNTBL(*NONE) to copy the data from an iSeries file to a shared folders document. Then attach the document (i.e., file) to an e-mail. Alternatively, copy the document from the "I:" drive to a PC diskette. Load the diskette in a PC connected to another iSeries and reverse the process (e.g., copy the file from the diskette to the I: drive, then use the CPYFRMPCD command with TRNTBL(*NONE) to copy it to a physical file). Note: The to-file on the CPYFRMPCD must already exist.
To continue reading for free, register below or login
To read more you must become a member of Search400.com
');
// -->

ode snippet -->
[TABLE] |
|
[IMAGE] |
You can also specify one of the other many standard translation tables loaded on the iSeries. You can even specify your own table to accomplish specialized data conversion.
Format of PC data parameter
Another parameter that plays a part in data conversion is the format of PC data parameter (TRNFMT keyword). This parameter accepts one of two special values, *TEXT or *NOTEXT, and is ignored if *NONE is specified for the translation table parameter.
Use *TEXT to have the data converted to an ASCII text file. ASCII text files on a PC are stored in variable-length records. Trailing blanks are removed from each record and the records are delimited at the end by a sequence of special characters -- a carriage-return character followed by a line-feed character. PC programs know they have reached the end of a record when this sequence of characters is encountered. You can use just about any popular word processor to edit an ASCII text file.
Using the *NOTEXT special value will result in fixed length records being created in the PC file. Trailing blanks are not removed and no special end-of-record characters are added to the end of the records. The length of the records is equal to the record length of the physical file being copied. Use *NOTEXT when copying data into a PC database.
Three other handy uses of the CPYTOPCD and CPYFRMPCD commands
Once you become familiar with these commands you will find other uses for them. Here are three of my favorites.
-----------------------------------
About the author: Ron Turull is editor of Inside Version 5. He has more than 20 years' experience programming for and managing AS/400-iSeries systems.

|