After doing further research on this I think you're better off either 
using 
http://www.scottklement.com/rpg/ifs.html
to create a tab delimited file in the ifs by reading this MF lf in RPGLE, 
or,
use his examples on writing directly to excel at
http://faq.midrange.com/data/cache/533.html
Because, what I am sure you are looking for is something like:
A   B
001 CompanyA
001 Dallas
002 Fort Worth
002 CompanyB
001 Fort Wayne
003 CompanyC
001 Kendallville
002 Avilla
where column A could be either company number or ship to number and column 
b could be company name or ship to name.
Or some gyration of this.
Avoid CSV or comma seperated variable, because of concerns about embedded 
commas in names like My Company, Inc.  There's workarounds but why take 
the hassle?
Excel can easily read a tab delimited.  Try it.  I used Notepad and typed 
in the above columns and replaced the space with a tab.  Did a save as 
.txt.  Exited Notepad.  Then used Windows Explorer to find it.  And said 
Open With Excel and it did a fine job.  And, if one row has more or less 
columns, no problem.  Try that with notepad and then excel again.
Rob Berendt
As an Amazon Associate we earn from qualifying purchases.