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
The solution
Transformation
How it works
- Transformations add RN fields to data, 1 for header and 2 for lines.
- Data is merged using union transformation.
- Data is sorted using F2 and RN fields
- The result is written into the target file
To view the example follow the steps below
- Download and install Advanced ETL Processor [Link]
- Download and Unzip example[Link]
- Create a new transformation and open the .ats file
- Double-click on the Reader object and amend the source file path
- Double-click on the Transformer object
- Double-click on the Lookup object and amend the source file path
- Double-click on the Writer object and amend the target file path
- Press the green arrow to run the transformation
Please contact us if you need help with transforming the data
Visit ETL Tools Forum |