flat files-Help

I need some help.

I have a flat file, which has HDR,TRL(header and tailor) and then inbetween i have multiple segments like INV,AWB and CHG. (those 3 segments will repeat ‘n’ no of times)…

i would like to get 1st block …i.e

INV|SINI44335|I|R|22052010|SGD|30|21062010|610249879|SIN|ABDUL
AWB|7740548863|610249879|T|TC|Z|NON REVENUE
CHG|X|IMPORT/EXPORT

need to placed in a file…say…ffdata and then need to use convert to values for 1st time, in second time i need to get

INV|SIN732106|O|N|05112009|SGD|30|05122009|610278761|SIN|ABDUL
AWB|2469885176|610278761|N|CREDIT/DEBIT|D|EXPRESS WWIDE
CHG|||-1|K|-0.50|-14.400000|0.000000|0.000000|0.000000|0.000000|0.000000|

these three lines to ffdata and then convert to xml…etc…

can any one provide me some suggestions…

sample file:
HDR|FFINV|3.0.0|APPLE|SIN|26052010|1809|
INV|SINI44335|I|R|22052010|SGD|30|21062010|610249879|SIN|ABDUL
AWB|7740548863|610249879|T|TC|Z|NON REVENUE
CHG|X|IMPORT/EXPORT
INV|SIN732106|O|N|05112009|SGD|30|05122009|610278761|SIN|ABDUL
AWB|2469885176|610278761|N|CREDIT/DEBIT|D|EXPRESS WWIDE
CHG|||-1|K|-0.50|-14.400000|0.000000|0.000000|0.000000|0.000000|0.000000|
TRL|7|1|14.50|265.980000|

how can i split the file and process one block at a time…??

One of the way to achive what you want is … write a simple java service and split the file into multiple small files, and then create schema for simple block and handle in IS.

i think that the most simple as well as effective approach for your scenerio.

-nD

Using node iteration will work too. Define the FF schema so that the records are defined as children as appropriate. Then the iterator will break up the file for you, by top-level record, so you don’t have to.

can you share if you have any sample package/services. please attach it…

In your flat file schema move AWB and CHG records under INV and in the INV properties set max repeat to unlimited.
structure of your schema should look like
HDR (max repeat = 1)
INV (max repeat = unlimited)
AWB(max repeat = 1)
CHG(max repeat = 1)
TRL (max repeat = 1)

Hope this will help you.

Thanks for all your suggestions