CPYTOIMPF and DB2 Field Names

15 pts.
Tags:
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
ASKED: May 31, 2007  11:19 AM
UPDATED: May 31, 2007  11:39 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

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

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following