This example demonstrates how to generate a flat file with a Header and lines from 2 readers

Question from the customer

I have two data files

Headers file :
HEAD1;01
HEAD2;02
HEAD3;03

Lines file :
Line1;01
Line2;01
Line3;03
Line4;02
Line5;02

I want to merge them so I can generate a file with header and line as below:

HEAD01
Line1
Line2
HEAD02
Line4
Line5
HEAD03
Line3

Original forum post

The solution

addheader

Transformation

 addheader

How it works
  1. Transformations add RN fields to data, 1 for header and 2 for lines.
  2. Data is merged using union transformation.
  3. Data is sorted using  F2 and RN fields
  4. The result is written into the target file  

To view the example follow the steps below

  1. Download and install Advanced ETL Processor [Link]
  2. Download and Unzip example[Link]
  3. Create a new transformation and open the .ats file
  4. Double-click on the Reader object and amend the source file path
  5. Double-click on the Transformer object
  6. Double-click on the Lookup object and amend the source file path
  7. Double-click on the Writer object and amend the target file path
  8. Press the green arrow to run the transformation 

Please contact us if you need help with transforming the data

Visit ETL Tools Forum