15 pts.
 CPYTOIMPF and DB2 Field Names
CLP
I have created an outfile from a series of iSeries queries and have successfully copied it to a CSV file on a Windows server share. However, the field names don't import with the CSV file. Is there a way to import the field names as column headers in the CSV using the CPYTOIMPF command or another command? Thanks in advance for any information. Bruce

Software/Hardware used:
ASKED: May 31, 2007  11:19 AM
UPDATED: May 31, 2007  11:39 AM

Answer Wiki:
Hi Bruce I'm afraid that the only way of doing this is to write a little program to handle it. Basically, you need a program that will performa a DSPFFD to an *OUTFILE and then read through the outfile picking up the field names and building a string as '"FieldA","FieldB","FieldC"...' until all fields have been read. You then need to add that as the first record of a fixed record length import file. Then when you do your CPYTOIMPF from the database file you specify MBROPT(*ADD) to add the data records after the headings. When you open the file in Excel then you will see the field names as column headings. Hope it helps Jonathan
Last Wiki Answer Submitted:  May 31, 2007  11:39 am  by  astradyne   370 pts.
All Answer Wiki Contributors:  astradyne   370 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


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