Defining a complex flat file schema

I have a FIXED-LENGTH file that looks like this:

  • Header line (length=17, occurs=1 time, record id=first 3 chars are HDR)
  • Order Header line (length=457, occurs=n times, record id=first 3 chars are 000)
  • Order Item line (length=181, occurs=n times for each Order Header line, record id=none)
  • Trailer line (length=14, occurs=1 time, record id=first 3 chars are TLR)

Is it possible to design a Flat File Schema for this type of complex structure?


It is very much possible.

Create a flat file dictionary with the following definitions.


Choose the Delimiter Record Parser.
Create a Record reference to Header (Occurs 1) and name it HDR
Create a sub Record Reference to OrdHdr(Occurs unlimited) and name it 000
Create a sub record Reference to OrdLin(Occurs unlimited) and name it recordWithNoID
Create a Record Refernce below the HDR to Trailer (occurs 1) and name it TLR

Also in the Settings tab, set the Default Record to OrdLin refering to the above dictionary.

That should work !!!
Bhavani Shankar


Thanks for the response. However, my problem is that the file is not delimited, it’s fixed-length, and as you saw in my original post, each type of record in the file has a different length.

I was able to make it work by doing pretty much the same thing you explained and by padding each line in the file to 457 characters before parsing. I would like, however, not to have to do the padding.