dharmendra_kp
New User
Joined: 10 Mar 2005 Posts: 33 Location: Lewiston
|
|
|
|
Hi All,
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.
Email: ***EMail ID REMOVED... Use CODE tag to include mail id*** |
|
Phantom
New User
Joined: 04 Sep 2005 Posts: 25
|
|
|
|
dharmendra_kp,
How many Header-Data-Trailer pairs do you have ?
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.
Code: |
SORT FIELDS=COPY
INCLUDE COND=(1,7,CH,EQ,C'TRAILER')
|
Hope this helps,
Thanks,
Phantom |
|