Announcement Announcement Module
Collapse
No announcement yet.
FlatFile reading Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • FlatFile reading

    I have a flat file that contains header,column names, data and footer in the following format

    Header|headercol1|headercol2|headercol3|headercol4
    column1|column2|column3.......
    data1|data2|data3..........
    .
    .
    .
    Trailer|RecordCount:XX


    1. Columns in header apply to all the data, so I need to set the values in data beans.
    2. Ignore the second row.
    3. Validate if data count = trailer data count, if not fail the process.


    Any suggestion on how to accoplish this?

    Thanks,
    Nitty

  • #2
    Can someone give me an idea(s) to do this?

    Comment


    • #3
      Use PatternMatchingCompositeLineMapper to handle the different line types differently. When you handle the header, store its data into the Step ExecutionContext so that it can be used in the future (and saved in case of an error). For each data item handled read the necessary things from the Step ExecutionContext. Also, update the aggregate information in the Step ExecutionContext (number of records etc) so you can keep running totals (again, that are saved in case of an error). When you process the trailer, you can read from the Step ExecutionContext and verify the information.

      Give that a shot. All of these concepts are detailed in the reference documentation. If you have specific questions about how to do these things, let me know.

      Comment


      • #4
        Thanks.
        How do I get a handle (inject) stepExection inside the processor - one of the previous post mentioned <quote> You can also inject the step execution into a step-scoped component with a late binding expression #{stepExecution}.
        </quote>

        Not sure how to do this - can you throw some light?

        Comment


        • #5
          Originally posted by Nitty View Post
          Thanks.
          How do I get a handle (inject) stepExection inside the processor - one of the previous post mentioned <quote> You can also inject the step execution into a step-scoped component with a late binding expression #{stepExecution}.
          </quote>

          Not sure how to do this - can you throw some light?
          you could try the following

          Code:
          private StepExecution stepExecution;
          
          	@BeforeStep
          	public void saveStepExecution(StepExecution stepExecution) {
          		this.stepExecution = stepExecution;
          	}
          and put scope step into your app context for that reader

          hope that helps

          Comment

          Working...
          X