COPYTOPCD Command

15 pts.
Tags:
AS/400 commands
CPYTOPCD
I'm copying the File from my AS/400 system to PC using command COPYTOPCD. But after copying all the numeric fields are containing zunk characters. Anybody know what can be the issue?

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi!
Are you sure those files you were transferring didn’t have virus? why dont you try to do a full scan?
~Dianne

Discuss This Question: 7  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Deepakas400
    the file is a Externally discribed Database file, and i want to copy the file in CSV format in PC. The file contains the Characts like f"Ø  ßØÉ| ¤a¬  r|°  ΰ "°é¤ m°" "j¬ "°â i¤°ë r|
    15 pointsBadges:
    report
  • Mariodlg
    I think you must review the numeric data type in your as400 file. Is there any packed number?
    2,790 pointsBadges:
    report
  • HermannWittig
    If you are trying to create a CSV file , I will suggest you to try the CPYTOIMPF instead and sen it to the IFS: Ex. CpyToImpf FromFile(YOURLIB/YOURFILE) ToStmf('home/YourFile.csv') MbrOpt(*Add) RcdDlm(*CRLF) RmvBlank(*Trailing)
    15 pointsBadges:
    report
  • TomLiotta
    But after copying all the numeric feilds are containing {j}unk chacters. Most likely, the problem is because you're using the CPYTOPCD command. A similar problem would happen if you used the CPYTOSTMF command (which should usually be used in place of CPYTOPCD). CPYTOPCD is not appropriate for copying most externally-described files into streamfiles. (Neither is CPYTOSTMF.) If you are intending to transfer data from an externally-described file into a streamfile, the most likely appropriate command is CPYTOIMPF. And if you intended to convert data from an externally-described file into a .CSV format, then the only native command to use is CPYTOIMPF. CPYTOPCD (and CPYTOSTMF) does not do data type conversions. It only copies entire record images, either as text or non-text (binary). It doesn't convert field-by-field. Any numeric fields will be copied as if they were just a substring of characters within the entire string of the record, regardless of any numeric data types. That is, packed numerics are not unpacked nor are binary integers converted to character digits. Tom
    125,585 pointsBadges:
    report
  • Oldtonew
    I ran into a similar situation when trying create a CSV file. The third party who created the file with DDS assigned different CCSIDs to some of the fields in the file. What I ended up doing was to create a file using DDS with identical field names and attributes except for the CCSID. Then I copied the original file to the one I created. After that I was able to use CPYTOIMPF. It wouldn't hurt to try DSPFFD FILE(mylibrary/filename) and look at the CCSID for the fields that are giving you the problems.
    135 pointsBadges:
    report
  • Craig Hatmaker
    Downloading to CSV is almost always for the purpose of getting data into Excel - and on occasions when it’s not, it is usually better to review results in Excel then save as CSV before sending to the final destination. If this is your situation you may find these alternatives more to your liking. [1] Data Transfer Add-In to Microsoft Excel . This add in comes with Client Access. Use it to transfer your file to Excel, then save to .csv. [2] MS Query and ODBC MS Query comes with Excel. The iSeries DB2 ODBC driver comes Client Access. When setting up the ODBC driver make sure the "Translation" tab has "Convert binary data (CCSID 65535) to text" checked to prevent similar problems to the one described.
    1,775 pointsBadges:
    report
  • TomLiotta
    The third party who created the file with DDS assigned different CCSIDs to some of the fields in the file. If the system is appropriately configured for CCSID handling and the job has an appropriate job CCSID attribute set, then it shouldn't matter if fields have different CCSID settings. CPYTOIMPF will do the conversions. Of course, if the CCSIDs for file data and for the resulting streamfile are incompatible, then a valid conversion can't be done. In that case, though, similar invalid conversions would happen after going through an intermediate file. Downloading to CSV is almost always for the purpose of getting data into Excel - and on occasions when it’s not, it is usually better to review results in Excel... I agree, even though it's not really how .CSVs should be used. CPYTOIMPF is intended more as the DB2 IMPORT/EXPORT function than for viewing data in Excel. If Excel is the actual intended target, then it's usually better to go with an actual Excel transfer method. However, there are numerous cases where manual Excel transfers are impractical. A batch job has trouble getting the Excel Data Transfer Add-in to run. Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following