Using CPYFRMIMPF to transfer data from CSV file to custom table on AS400/
0 pts.
0
Q:
Using CPYFRMIMPF to transfer data from CSV file to custom table on AS400/
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?
ASKED: Mar 12 2007  2:57 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
0 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
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.
Last Answered: Mar 12 2007  3:53 PM GMT by JDWWms   0 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

CarterC19   170 pts.  |   Mar 12 2007  4:36PM GMT

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.

 
0