Announcement Announcement Module
Collapse
No announcement yet.
Reading COBOL files with packed and hex fields.... Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reading COBOL files with packed and hex fields....

    Hi,

    I got a new task to read a file that is obviously ASCII but contains hex packed and nonpacked fields, I tried to use de FlatFileItemWriter since its a fixedLength file, but instead of reading any data it gets a parsing Error because the first byte he reads in is interpreted as a new line... thus returning an empty line to the mapper.

    Is there any way around this do I have to program it myself or is there support for this kind of files that I have not found yet?

    This is the first time I got a file like this.

    The file's structure begins like this

    length 2, hex
    length 9, packed
    length 3, char
    length 3, char
    length 6, packed
    .
    .
    .
    and so on.

    I'm grateful for any direction anyone can give me...

    Thank you.

  • #2
    I had an idea but...

    So I came up with an idea to work around the problems I have, to override the doRead method in a extended FlatFileItemWriter.....

    Yet again for the XXth time I have the problem that every variable can be set but is not available in the child class...

    Whats the point of making doRead() and the other methods protected if you don't even have access to the BufferedReader or what ever else???

    Every time I have to copy the whole class into mine instead of just changing the one method I want to change just because the stuff I need to do it is not available to me...?

    I want to retain most of the functionality, but it is not possible to correctly extend it... that is not the first time I encounter this problem ...

    *frustrated*

    Comment


    • #3
      Read the entire line as a single String, and then in a linemapper substring up your line and set it into your domain objects.

      We couldn't find a good library to convert packed decimal into number... so we wrote a little guy.

      Comment

      Working...
      X