Wednesday, November 18, 2009

AS/400 Tip 1

Converting an AS/400 database file to a CSV file
You may find yourself in a situation where you want to run a Query on a file, save the information to a database,and then convert that information to a Comma Separated Variable (CSV) file. This is especially true when you need the data to be used in a "spread sheet" format like Excel.
The simplest way to do this is to copy the information from the data file to your newly created CSV file.

Enter this command:
CPYTOIMPF FROMFILE(*LIBL/DTAFIL) TOFILE(USER999/CSVPC)
Hit Enter, and then again 3 times and you have now created a Comma Separated Variable (CSV) File.
Remember that you need a 'destination file' before you can use this command. To create a 'destination file', you will need to use the Create Physical File command. To create a file named CSVPC that is 200 characters in length, type in the command:
CRTPF FILE(USER999/CSVPC)
Hit F4 to prompt the command, and type in the record length you need, for Member, be sure to name it CSV.

Source: http://www.texas400.com/b400tip23.html

No comments:

Computers Add to Technorati Favorites Programming Blogs - BlogCatalog Blog Directory