Using CPYFRMIMPF to transfer data from CSV file to custom table on AS400/

pts.
Tags:
AS/400
Hello, I need to run a report comparing data from an Excel spreadsheet to data on an AS400 system. I created a table on the AS400 with identical field names to the excel file, which I saved as a CSV. I want to be able to copy the comma delimited contents of this file into the table on the AS400 in such a way that the contents of the file properly populate correlating rows of the table. I tried doing this using the CPYFRMIMPF command where the CSV file was the first parameter, the table was the second, and the comma was the record delimiter: CPYFRMIMPF FROMFILE(My CSV File) TOFILE(My AS400 Table) RCDDLM(',') However, immediately receive the following error, "The copy did not complete for reason code 5." How can I fix this error and copy the contents of the CSV file to my custom AS400 table so that the rows match my comma delimited data?

Answer Wiki

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

I’ve always found the easiest weay to do what you trying to do is create the file on iseries with fields matching the file on the PC and then use the the File transfer from 400 option to download the file using the FDF. Once you have the downloaded file matching the file format of the original PC file, you can use the transfer to A00 option and reference the FDF and the system will map it out. No need to convert to CSV first.

===========================================================

What is the error message identifier? The message text is almost useless to us. What version/release of the operating system are you running? Is that an accurate representation of the CPYFRMIMPF command that you showed?

It’s hard to determine an answer since there is almost no useful info to go on.

However, it looks like you’re leaving out some likely necessary parameters from the command. For example, without knowing any more, I’d bet that you need to specify something other than the default for the RCDDLM() parameter. Most likely it should be RCDDLM(*CRLF).

Any number of other possibilities exist.

Did you look at “reason 5″ and did you even try the suggested recovery?

Tom

****************

Tom, if your intention is to supplement this discussion for later reference, then why not just provide the useful comments you have instead of appearing antagonistic in the response to the original poster who’s probably figured it out by now, or gotten the assistance they needed, since this question is from almost two years ago?

CWC
****************

Discuss This Question: 1  Reply

 
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
  • CarterC19
    I finished a little project recently using CPYFRMIMPF to a regular iSeries file, and found that I had to make accomodations in the DDS for the possibility of null data in the incoming (PC) file. Adding the ALWNUL keyword to the iSeries DDS field specs resolved a whole gaggle of little errors that stopped the transfer cold. You may want to look at the PC file data for the possibility of null data. The reason code that it returns, by the way, is actually somewhat useful, if you bring up the online help for it.
    220 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