How can I define a Begin and End marker for a file.

How can I define a Begin and End marker for a file.

book

Article ID: KB0086230

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks Plug-in for Files for Unix and Windows -
Not Applicable -

Description

Resolution:
Below is an extract from a input file:

Order, ID1, 20May2000
Item, ID1Start, 60, $75
Customer, Hopkins Associates, ID26490
Order, ID2, 20May2000
Item, Rt.Clopper, 40, $100
Customer, Jersey WebInovaters, ID46786

To define the start end end of the file, you will need to run a pre-processing script that will add a DummyHeader to the start of your Files and a DummyTrailer to the end. Your file should then look like this:

HEADER
Order, ID1, 20May2000
Item, ID1Start, 60, $75
Customer, Hopkins Associates, ID26490
Order, ID2, 20May2000
Item, Rt.Clopper, 40, $100
Customer, Jersey WebInovaters, ID46786
TRAILER

In your repository, you will need to create a new File Record called DummyHeader for the line HEADER and DummyTrailer for the line TRAILER.

A new Read Schema (A) is then created and the File Records DummyHeader is added. The File Records Order, Item and Customer are added as details of DummyHeader.

You then create a second Read Schema (B), and only add the File Record DummyTrailer.

In your PublicationService, under the Schema tab, you first add Schema A, and under it you add Schema B.

When File Adapter runs it will parse all lines in the input file under HEADER until it reaches the TRAILER record. File Adapter will publish one message for Header and the Details, and a second message for the Trailer.

Issue/Introduction

How can I define a Begin and End marker for a file.