complex flat file processing

Hi All,

I have a requirement in which we have process a complex flat file.

Flat contains large number of records seperated by Pipe(|) deliminator i,e:

0001|abc|bcd… Parent Record.
0001|abc|bcd…Parent Record
0002|abc|bcd…Child Record
0001|abc|bcd…Parent Record
0002|abc|bcd…Child Record
0003|abc|bcd…Child Record

The record starts with 0001 is the parent record and all the below records will be its child record until it encounters another 0001 record.

Our requirement is to publish the in the way like:

0001|abc|bcd…
one doc will be publish containing only this record.

0001|abc|bcd…Parent Record
0002|abc|bcd…Child Record
One doc will be published containing these two records.

0001|abc|bcd…Parent Record
0002|abc|bcd…Child Record
0003|abc|bcd…Child Record
One doc will be published containing these three records.

In 4.6 version it was very easy as we only need to set on of the parameter…it does all…Please is there is any way in 6.5 version…