Creating a text file from AS/400 for a purchase order
I would like to create a text file from the AS400, I need to be able to have a header line followed by line details. It's a Purchase Order which I need to email as a text file. What is the best way of doing this?

Software/Hardware used:
ASKED: December 9, 2008  6:58 PM
UPDATED: December 10, 2008  8:31 PM

Answer Wiki:
I would do it with an RPG program writing to a "flat" file -- one field type alpha. The RPG program builds each line and writes it to the file. You can transfer the file to your ifs and e-mail it unless you have a better e-mail method.
Last Wiki Answer Submitted:  December 9, 2008  7:34 pm  by  philpl1jb   44,190 pts.
All Answer Wiki Contributors:  philpl1jb   44,190 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

I recommend just writing to a regular externally described file, and then copying that database file to the IFS with the CPYTOIMPF (copy to import file) command. That way, your RPG program doesn’t have to anything extra, since a lot of the functionality you’d want is already built into CPYTOIMPF. You can chose for the fields in the record to be delimited, or just be in a fixed record length, among several other options.

You could proceed with emailing from there, depending on the level of automation you’d want (such as if it’s a one time or recurring process).

 4,275 pts.