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:
Drag a
tMap
component onto the canvas.Connect the
tFileInputFullRow
totMap,
and rename the flow tocustomerIn
.Open
tMap,
and create three new outputs. Name themheader
,detail
, andtrailer
.Copy the input field line into each of the new outputs.
Add the expression filter
customerIn.line.startsWith("00")
to the header output table.Add the expression filter
customerIn.line.startsWith("01")
to the detail output table.Add the expression filter
customerIn.line.startsWith("99")
to the trailer output table.Your
tMap
should now look like the one shown as follows:Close
tMap,
and drag threetExtractDelimitedFields
components to the canvas, along with threetLogRow
components.Join each output from
tMap
to each...