#1: Header and Trailor Author: veeru_ch, Posted: Sun Apr 22, 2007 2:46 pm Hi,
Can any one explain me what is use of header and trailor records in a file. This is an interview question.
Thanks in Advance
Veer
#2: Author: dbzTHEdinosauer, Location: germanyPosted: Sun Apr 22, 2007 3:19 pm A Header record would contain information that would differentiate this file from other files - date, etc - is made up of info known at the begining of he process that created the file. A header record is the the first record in the file.
A Trailer record would contain statistics about the file that were accumulated during the process that created the file- counts, amount totals , etc... A trailer record would be the last record in the file.
#3: Author: veeru_ch, Posted: Mon Apr 23, 2007 3:49 am Dick, Thanks for the quick reply, Is there is any possibility of having more than one trailor for a file.
#4: Author: dbzTHEdinosauer, Location: germanyPosted: Mon Apr 23, 2007 4:19 am well, yeah. depends upon the original design. there maybe more data to pass with the trailer record than can fit in one record.
normally when a ds (dataset) has more than one record type, there is a common field, (often the first char) that defines the record type; for example:
1 - header record
2 - detail record
3 - trailer record
This can obviously become more complex and require two char for the definition
01 - header
02 - detail record type 1
03 - detail record type 2
04 - detail record type 3
12 trailer record with accumulated stats on detail record type 1
13 trailer record with accumulated stats on detail record type 2
14 trailer record with accumulated stats on detail record type 3
99 trailer record with accumulated stats on complete DS
Normally, a program that processes a DS which contains header/detail/trailer record, the individual trailer records are compare to accumulations to insure that number of records and totals in are equal to those output by the creating program.