ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Reading Flat file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reading Flat file

    Hi Guys

    Hope you are in the pink.I have a flat file say 'INFILE' which has both data and image. The record length of the file is 512 bytes. I need to read this file 512 bytes by 512 bytes and extract data and do some processes. The format is like the first two bytes contains the length of the Header record followed by header details.This is followed by record length of detail record.This is followed by detail record. This is followed by multiple detail records and finally the trailer record.


    The date looks like 25HABCDEFG...................500DGGGGGFFF$$$$$$$$$ $$$$$. the first two bytes 25 represents the length of the header record.The third byte 'H' represents the header record.The 28th and 29th Byte represents the length of the detail record.it is 500. The 'D' following this shows that it is a detail record.the length of the header data structure is 25 and length of the detail data structure is 400. If the length of the detail record(28th and 29th byte) is > length of the detail data structure, then Image is present else the detail record does not contain images.

    Note that I can read the 'INFILE' only 512 bytes by 512 bytes.If my detail record length exceeds 512 , I need to read the INFILE and extract the bytes to the length of the detail record.

    Do anyone have a sample program which does similar kinda stuff?

    Plz send me if you have one.Eagerly waiting for ur replies.


    Thanks a lot in advance.

    Have a nice day buddies.

    Cheers

    Nand...
Working...
X