This example demonstrates how to insert records into the file 

Question from the customer

I have the following file

HEAD01,Line1
HEAD01,Line2
HEAD02,Line4
HEAD02,Line5
HEAD03,Line3

I want to create a file with the header and line as below:

HEAD01
Line1
Line2
HEAD02
Line4
Line5
HEAD03
Line3

Original forum post

The solution

addheader

Note:  this example is based on 0025 Merge Header and Lines file 

How it works

  1. The first transformation adds the header number field
  2. Next transformations add RN fields to data, 1 for header and 2 for lines.
  3. Data is merged using union transformation.
  4. Data is sorted using  F2 and RN fields
  5. 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