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.
Can you expand on your answer a little bit. Like thenecessary steps to upload the file or do you put it in a folder? Once inb a folder then use the CPYTOIMPF command, etc.
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 example below converts a CSV called "myfile.csv, located in the root of the AS/400 IFS to a dds or sql-described physical file called MYPHYISCAL in library MYLIB, replacing any datat that might already be in that file.
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.
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.