Announcement Announcement Module
Collapse
No announcement yet.
how to skip lines(as per my requirement) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to skip lines(as per my requirement)

    Hi,
    My Input source is text file, which has 2 types of records totally.
    H: and T: with prefixes.

    If i encounter a duplicate H: record again while reading the file, i should skip that set and jump to next H: record directly.(i don't want to process duplicate records)

    I tried to use setLinesToSkip(int someValue), but this does not completely solve the problem, i should be able to go directly to next H: record only. if i perform some logic and get the number of lines to skip, then the line which i read may or may not be H: record.

    Thanks,

  • #2
    Ramesh,

    The linesToSkip method skips the header lines (i.e. records from top of the file). But your requirement seems that the H: lines may appear anywhere in the file. I think you need to handle this in ItemValidator and mark T: records as invalid records.

    Let me know if you resolve this in better way.
    Last edited by Saravan; Jul 21st, 2009, 10:18 AM. Reason: corrected spelling mistake

    Comment


    • #3
      Thanks Saravan,

      my input file will be in this format
      H:
      T:
      T:
      H:
      T:
      H:
      T: ....

      so if i encountered a H: record which is already read(duplicate record in the input file), i should be able to jump to next H: record. means skip the lines untill i encounter again H: record

      Thanks,

      Comment


      • #4
        Since your input record occurance does not follow any pattern, I think you should handle in ItemValidator and skip the T: records.

        Comment


        • #5
          Thanks for ur reply,

          The problem is not with the pattern, its to find whether we are reading a duplicate record or not. To read/identify a duplicate record, we don't need any pattern

          Your solution may not solve the issue. Thanks for ur time

          i will check with the senior member comments.

          Comment


          • #6
            It is something to be handled at the ItemValidator or ItemProcessor level. However I'll watch this page in case this can be resolved by any other means.

            Comment


            • #7
              You should be able to do a multiline reader, cache a md5checksum of your line input into a hashmap held in an execution context, and use a skipListener if a hashmap entry exists.

              Comment

              Working...
              X