I will appreciate if any one provides me logic to read only first and last record i.e. Header & Trailer record of a PS FILE, for validation purpose.
There is no record count in header file and since file size is very big I want to avoid reading detailed records, if the content of header and trailer records are not proper there should not be processing on the detailed record.
I will appreciate if members provide me quick reply.
1. If you have only one Header-Trailer then you can probably sort the input file before processing so that Trailer record comes before data.
2. Since you said that ur input file is huge, SORTING will not be efficient. Instead using SORT, you can separate the trailer record alone into a separate file and pass it as one more input to your cobol program. If this second input file contains valid info. then process your full file which contains the data.
For example, if you have TRAILER in the first 7 bytes of your trailer record then use the Sort card below to separate the record into a new file.