Tuesday, 22 April 2014

HOW TO REVERSE THE CONTENTS OF FLAT FILE – INFORMATICA

I have a flat file, want to reverse the contents of the flat file which means the first record should come as last record and last record should come as first record and load into the target file. 
As an example consider the source flat file data as
Informatica Enterprise Solution
Informatica Power center
Informatica Power exchange
Informatica Data quality
The target flat file data should look as
Informatica Data quality
Informatica Power exchange
Informatica Power center
Informatica Enterprise Solution
Solution:
Follow the below steps for creating the mapping logic
  • Create a new mapping.
  • Drag the flat file source into the mapping.
  • Create an expression transformation and drag the ports of source qualifier transformation into the expression transformation.
  • Create the below additional ports in the expression transformation and assign the corresponding expressions
Variable port: v_count = v_count+1
Output port o_count = v_count
  • Now create a sorter transformation and drag the ports of expression transformation into it.
  • In the sorter transformation specify the sort key as o_count and sort order as DESCENDING.
  • Drag the target definition into the mapping and connect the ports of sorter transformation to the target.
Thanks
Ur's Hari
If you like this post, please share it by clicking on g+1 Button.
https://www.facebook.com/InformaticaDevelopers

2 comments: