Development

Write column names to the first row of a flat file target

Solution
Writing column names in the first row of a flat file target using PowerCenter (version 8.1 or update) session, do the following:

  1. Edit the session with the flat file target in Workflow Manager.
  2. Select the Mapping tab.
  3. Select the target file.
  4. Scroll to the Header Options attribute.
  5. Select Output Field Names from the attribute list.

01

NOTES:

By default, this option is set to No Header.

When this option is selected, the server writes the target definition port names to the flat file target in the first line, starting with the hash symbol (‘#’).

 

More Information

Remove the hash symbol from the flat file header in PowerCenter

 There are two methods:

1. Starting from PowerCenter 9.1.0 Hot Fix4:  an undocumented custom flag RemoveOutputHeaderHash has been added. To remove the hash from the flat file header, set the RemoveOutputHeaderHash flag to Yes

02

2. Use the Power Center session “Header Command” output option: In target properties, for Header Options, select ‘Use header command output’. For the Header Command uses ECHO (Windows) or CAT (UNIX) and paste the column names into the header command line. This must include the names of the columns in the correct order separated by the correct number of spaces (fixed width target) or by the correct delimiter (delimited file).

Example:

Use header command output and the following Header command:

Echo OUTPUT NAME, ID

With this setting the target file is written as follows:

OUTPUT NAME, ID

User1, 01
User2, 02
User3, 03

 

 

Thoughts on “Write column names to the first row of a flat file target”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow Us
TwitterLinkedinFacebookYoutubeInstagram