• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Spring Batch Multiline Flat File Processing

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a flat file csv format that has a header, and line items. The records have a record identifier in the first position H for header and L for line item. The way I process the file now with java is that I read from header record to header record, so I read a header record and then read each line after that record which is reading in the lines until I read another header which then is the start of the next record. So I don't have an explicit end of record marker. I am trying to convert the process over to Spring Batch and I see that I can implement a RecordSeperatorPolicy which will call the isEndOfRecord method to determine if all the lines that make up the record have been read in. However since I have no explicit record terminator I am not sure how what I would need to do in order to implement the RecorSeperatorPolicy to work in my situation.

Logical File Layout

H, CompanyName, DepartmentCode, ContactFirstName, ContactLastName
L, LineNumber, Amount, Quantity, Price, Measure
L, LineNumber, Amount, Quantity, Price, Measure
L, LineNumber, Amount, Quantity, Price, Measure
H, CompanyName, DepartmentCode, ContactFirstName, ContactLastName
L, LineNumber, Amount, Quantity, Price, Measure
L, LineNumber, Amount, Quantity, Price, Measure

Thanks for any help
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic