0

I have a flat file which contain data with Fixed length,Is there any good approach to parse the data and splitting the lines using a regular occurrence,ie for every occurrence starting with "02" should be a new line and it should be stored some where?I have gone through Flatworm which uses a XML,which will be lengthy process if lot of fixed length data is to be inserted?

Note:I have gone through some samples of Flat file parsing in stackoverflow using Flatworm and FFP,but cant be a standard one,as I am trying to do it as a utility class.

Text file seems to be like:

022010015450696611KR GERGIN MR vvvv 020100145078211PETRO EMILIAN MR vvv

Prabhath kesav
  • 428
  • 3
  • 6
  • 21
  • write a loop, perhaps? This might turn out to consume the least amount of developer time. – John Dvorak Nov 27 '12 at 09:01
  • 3
    Might be interesting for you: [Converting Flat File to Java Objects](http://stackoverflow.com/questions/1294405/converting-flat-file-to-java-objects) – Kai Nov 27 '12 at 09:02
  • What database are you using? Chances are that there is a tool already for this purpose, like [sqlldr for Oracle](http://www.orafaq.com/wiki/SQL*Loader_FAQ), I think DTS for MS SQL Server, etc... Of course, this is only applciable, if you don't want to do this programmatically... – ppeterka Nov 27 '12 at 09:45
  • @ppeterka I am using Oracle as DB – Prabhath kesav Nov 27 '12 at 09:54
  • @ppeterka I need to do it programatically – Prabhath kesav Nov 27 '12 at 10:36
  • @Prabhathkesav sorry, then in that case, this is not applicable... Unless you want to start sqlldr from `Runtime.exec()`, which would be very ugly, and absolutely unflexible... – ppeterka Nov 27 '12 at 11:44

0 Answers0