Tuesday 22 September 2015

Remove ‘#’ symbol from Informatica flat file target


If you are using  flat file as a target, you may encounter a problem which adds a # symbol to the  header as shown in the image below:
To resolve this issue, please  follow one of the methods explained below:
1. For Informatica 9.1 HotFix 4 and later users:
Remove ‘#’ by using Informatica session level property. Remember that this option is available only from Informatica 9.1 HotFix 4 or later. Earlier versions of Informatica users can follow method 2.

1.       In Informatica workflow manager, Go to Session -> Edit -> Config Object.
2.       Go to Custom Properties under Advanced section.
3.        Add the below values in Custom Properties.
  • Attribute: RemoveOutputHeaderHash
  • Value: Yes
4.       Save the changes and execute the workflow, notice that ‘#’ symbol is removed from the header.


2. For earlier version of Informatica (9.1 HotFix 3 or earlier versions) users:
Session property mentioned above is not available In earlier version of Informatica PowerCenter. Here is the workaround: 
 1.       In Informatica workflow manager, Go to Session -> Edit ->Mapping.
2.       Select your target in left pane.
3.       Change the Attribute and its value as mentioned below in Properties section.
  •  Header Options: Use header command output
  •  Header Command: Give command according to your requirement (eg. ECHO EMPLOYEE_ID, EMPLOYEE_NAME, SALARY)
4.       Save the changes and execute the workflow, notice that ‘#’ symbol is removed.


3.  For Linux/Unix based Informatica users (using command task):
 Linux and Unix users can remove ‘#’ symbol from target flat file header by following  these steps:
1.       Create a Command Task and edit the task.
2.       Go to command tab and add the below commands:
  • Name: RemoveHashSymbol (for example only, you can name anything)
  • Command: sed ‘s/#//’ EMPLOYEE_SALARY.csv (your target file name)
  • Note:- sed is the replace command, 's' denotes substitution operation, # is the search pattern and no character present between // is the replacement string. This command removes  # symbol from first occurrence of every line.


3.      Add this command task after the session task and execute the workflow. 
4.    Session creates the target with ‘#’ symbol in the header and command task will replace it by executing sed command.

1 comment: