Duke_W
asked on
Upload CSV File to iSeries
I need to upload a CSV file to the iSeries. I have created a program withh DDS specs that define data field A as 15 bytes long. With a CSV file data field A in the first run may be 15 bytes long. The second run the file data field A may be only 5 bytes long. Is there a way to upload the CSV file as long as the columns are consistent? There is always a data field A in same spot it just has varing field lengths.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Tom,
Can you please provide more details. Thanks
Can you please provide more details. Thanks
- Open Navigator
- Nanvigate to the Integrated File System root (My Connections - you system - File Systems - Integrated File System - Root)
- Drag and drop your CSV there (let's call it myfile.csv)
- Use the CPYTOIMPF command to copy the CSV (path is '/myfile.csv) into your database file. Prompt the command read the extensive online help for each parameter. If you aren't familiar with AS/400 commands, type the command name on the command line of an interactive session and press F to prompt the command. If you need help, put your cursor on the item that you want help with, and press F1.
The CSV has the following characteristics:
1) Each record ends with a carriage return and line feed (Windows-style)
2) The file is delimited
3) The field delimiter is a comma
4) The string delimiter is the doublequote character.
- Gary Patterson
CPYFRMIMPF FROMSTMF('/myfile.csv')
TOFILE(MYLIB/MYPHYSICAL)
MBROPT(*REPLACE)
RCDDLM(*CRLF)
DTAFMT(*DLM)
STRDLM(*DBLQUOTE)
FLDDLM(',')
...press F to prompt the command...
Minor typo -- "press <F4> to prompt".
But pay attention to Gary. He has the knowledge and the time to provide as much as you need. It's rare that I even see significant typos in his answers.
Tom
Minor typo -- "press <F4> to prompt".
But pay attention to Gary. He has the knowledge and the time to provide as much as you need. It's rare that I even see significant typos in his answers.
Tom
Tom,
Good catch. Thanks!
- Gary
Good catch. Thanks!
- Gary
ASKER