Troubleshooting
Problem
This document describes how to use the CPYTOPCD and CPYFRMPCD commands.
Resolving The Problem
Copy to PC Document (CPYTOPCD) and Copy from PC Document (CPYFRMPCD) perform a basic data conversion between EBCDIC and ASCII. These commands access IBM i database files and PC text files stored in the QDLS document library system (shared folders).
Sources of Documentation
Consult the following reference materials for more information on the topics discussed in this document:
o SH21-0703-00 Office Services Concepts and Programmer's Guide
o SC41-3307-00 Distributed Data Management
o SC41-3557-00 Client Access/400 for DOS User's Guide
o SC41-3558-00 Client Access/400 for DOS Setup (DBCS)
Note: The documents are all much older versions than the current IBM i OS versions. No newer manuals exist on these topics and none are planned.
These commands have not been enhanced or changed in recent years. However, more current documentation can be found in the IBM Knowledge Center:
610:
http://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_61/ddp/rbae5famcopy.htm
710:
http://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_71/ddp/rbae5famcopy.htm
720:
http://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_72/ddp/rbae5famcopy.htm
730:
http://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/ddp/rbae5famcopy.htm
740:
Sources of Documentation
Consult the following reference materials for more information on the topics discussed in this document:
o SH21-0703-00 Office Services Concepts and Programmer's Guide
o SC41-3307-00 Distributed Data Management
o SC41-3557-00 Client Access/400 for DOS User's Guide
o SC41-3558-00 Client Access/400 for DOS Setup (DBCS)
Note: The documents are all much older versions than the current IBM i OS versions. No newer manuals exist on these topics and none are planned.
These commands have not been enhanced or changed in recent years. However, more current documentation can be found in the IBM Knowledge Center:
610:
http://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_61/ddp/rbae5famcopy.htm
710:
http://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_71/ddp/rbae5famcopy.htm
720:
http://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_72/ddp/rbae5famcopy.htm
730:
http://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/ddp/rbae5famcopy.htm
740:
CPYTOPCD
The Copy to PC Document (CPYTOPCD) command copies the contents of one member of an IBM i physical file to an ASCII text file in a shared folder. The resulting text file can be accessed by PC applications or copied to a PC disk. To do so use any function that can access the IBM i Integrated File System (IFS) such as a NetServer network drive connection, Navigator for i, or ftp.
![CPYTOPCD Prompt Screen filled in with from filee and to folder names.](/support/pages/system/files/support/nas/nastech.nsf/0/a6fd544704e100c585257bc100528be8/Content/114.26A2.gif)
In this example, the data in the first member of file MYFILE in library MYLIB is copied to a PC document with the same name as the member in the folder MYFOLDER. The default translation is used and the resulting PC document contains variable length records. The PC document is not replaced if it exists and all record formats associated with the member are used.
From file | The IBM i physical file that data is to be copied from. |
Library | Library containing the IBM i physical file. |
To folder | Shared folder in QDLS that contains the target PC text document. |
From member: | The IBM i physical file member that is copied from. |
To document | The name of the target PC text document being created or overwritten. |
Replace document *YES *NO | Whether or not existing documents are replaced. Documents are replaced. If the document exists, it is not replaced and an error is returned. |
Translate table | Translation table used for EBCDIC-to-ASCII conversion. (See section Translation tables.) |
Library | Library containing the translation table specified. |
Format of PC data *TEXT *NOTEXT | Specifies variable or fixed-length fields. Variable length ASCII file is created. Record length is used to create a fixed-length file. |
DBCS code page | Specifies the double-byte character set used for translation. Unless overridden by the Translate table prompt (TRNTBL parameter), this parameter also specifies the single-byte translation table. |
Record Format | Allows the record format used to be specified. |
CPYFRMPCD
The Copy from PC Document (CPYFRMPCD) command is used to copy the contents of an ASCII text file, in a shared folder, to a member of an IBM i physical file. The member can be accessed by IBM i applications, printed to IBM i printers, or backed up just like any other physical file.
![CPYFRMPCD Prompt screen filled in with from folder, to file, and document names.](/support/pages/system/files/support/nas/nastech.nsf/0/a6fd544704e100c585257bc100528be8/Content/234.3BC0.gif)
In this example, the text in MYNOTES.DOC in folder MYFOLDER is copied to the first member in physical file MYFILE in library MYLIB. Any existing records are replaced. The default translation table is used, and the PC document has variable length records.
From folder | The folder that contains the PC text document holding the data that is copied. |
To file | The target IBM i physical file that the data is copied to. |
Library | The library containing the IBM i physical file. |
From document | The PC text document holding the data that is copied. |
To member | The target IBM i physical file member that the data is copied to. |
Replace or add records | Specifies whether data is overwritten or appended to the member. |
Translate table | The translation table used for data conversion. |
Library | The library where the translation table is located. |
Format of PC data *TEXT *NOTEXT | Specifies variable or fixed-length PC data. PC file contains variable length records. PC file contains fixed-length records. |
DBCS code page | Specifies the double-byte character set used for translation. Unless overridden by the Translate table prompt (TRNTBL parameter), this parameter also specifies the single-byte translation table. |
Insert DBCS SO/SI | Specifies whether shift-out and shift-in characters are inserted during translation. This parameter is valid only for double-byte character set users. This parameter is not valid if *NONE is specified on the Translate table prompt (TRNTBL parameter). |
Translation Tables
The CPYTOPCD and CPYFRMPCD commands make use of the code page translation tables stored in QUSRSYS. These tables contain character listings for conversion between the available character sets on the IBM i products system.
The default translation table is specified when the Initialize Client Access/400 (INZPCS) command is run. When run, INZPCS creates a data area named QINZPCSDA in library QUSRSYS. This data area has the ASCII and EBCDIC code page values specified in the INZPCS command. This is the translation table used when Translate table *DFT parameter is specified for CPYTOPCD and CPYFRMPCD.
Note: Basic information about INZPCS can be found here:
http://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/cl/inzpcs.htm
This data area can be displayed with the following command:
DSPDTAARA DTAARA(QUSRSYS/QINZPCSDA)
The default translation table is Qxxx337yyy, where xxx is the ASCII code page (default value 437 for SBCS) and yyy is the EBCDIC code page (default value 037 for SBCS). If the data area becomes corrupted, delete the data area and run INZPCS again to re-create.
At times, customized translation tables might be needed to handle special characters or other nonstandard conversions. Customizing translation tables is not a process that is supported by the IBM i Support team. Assistance with this process can be obtained on a consulting basis (separate billable contract). For your convenience, here is an overview of the process:
Custom conversion tables can be built with the following process:
1. | On the operating system command line, type the following: CRTTBL Press F4 to prompt. |
2. | Enter the new table name and library. |
3. | For Source file, enter *PROMPT, leave library blank. |
4. | Press F10. |
5. | Press F9. |
6. | For basing table, use the default table that you wish to modify. For example, to create a modified US English ASCII to EBCDIC table, select the appropriate table (for example, Q437337037 in library QUSRSYS for US English ASCII-to-EBCDIC). |
7. | Press the Enter key. |
8. | Change any values as needed. |
9. | When finished, press F6 to create the table and exit back to a command line. |
Limitations
The CPYTOPCD and CPYFRMPCD commands are intended to act only as a simple converter between ASCII and EBCDIC data. This conversion is performed character by character on the file, and no other data conversion is done. Non-character data might not convert to a readable form when processed with CPYTOPCD and CPYFRMPCD. Special data fields, such as packed numeric, are converted character by character, resulting in unreadable data in the PC file. Likewise, zoned decimal negative values are not be converted, since the negative is not stored as a minus sign (-) in the numeric value.
Special characters that are not included in the ANSI alphanumeric set might not be converted. The extended ASCII character set has many characters that have no equivalent in EBCDIC, and vice-versa. By default, these characters are converted to blanks by CPYTOPCD and CPYFRMPCD. To convert special characters, a custom translation table can be built.
The CPYTOPCD and CPYFRMPCD commands are limited to files of 2 GB in size or less. This coincides with the DOS file limitation of 2 GB. Physical files larger than 2 GB in size must be split into two or more smaller files before conversion.
[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"6.1.0"}]
Historical Number
9442158
Was this topic helpful?
Document Information
Modified date:
18 December 2019
UID
nas8N1010053