Reading headers and trailers using tMap

This recipe shows how to parse a file that has header and trailer records, and a record type at the start of a line.

Getting ready

Open the jo_cook_ch08_0060_headTrailtMap job.

How to do it...

The steps for reading headers and trailers using tMap are as follows:

  1. Drag a tMap component onto the canvas.
  2. Connect the tFileInputFullRow to tMap, and rename the flow to customerIn.
  3. Open tMap, and create three new outputs. Name them header, detail, and trailer.
  4. Copy the input field line into each of the new outputs.
  5. Add the expression filter customerIn.line.startsWith("00") to the header output table.
  6. Add the expression filter customerIn.line.startsWith("01") to the detail output table.
  7. Add the expression filter customerIn.line.startsWith("99") ...

Get Talend Open Studio Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.