I have a file with a No. of records and a control record (containing count of records) at the end. I would like to check that No. of records actually match the control record count, then only I will take the file for further processing. What will be the most efficient design for matching the counts.
Thanks.
File processing question
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Lots of possible ways. A server job using an Aggregator, a server job using a Transformer stage reporting @INROWNUM into a hashed file with a constant key, an Execute Command activity executing a wc -l command are among them.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 597
- Joined: Fri Apr 29, 2005 6:19 am
- Location: Singapore
mydsworld,
In general, this kind of files will have some kind of identification of header record, detail record and footer record. Do you have something like shown below?
0$filename
1$detailrecord
1$detailrecord
...
...
2$footerrecord
where record starting with 0 is header, 1 is detail and 2 is footer. Basically, you need to keep the count increasing while reading detail records and compare the count with footer record's count. Ray has given some ideas too.
Just as a FYI. I used this kind of files in the past where we check the files and load a table with a flag whether the file meets the expectations to be processed. Then we read the table and then process the files whose entry has flag Y in that table. This also helped us to troubleshoot.
In general, this kind of files will have some kind of identification of header record, detail record and footer record. Do you have something like shown below?
0$filename
1$detailrecord
1$detailrecord
...
...
2$footerrecord
where record starting with 0 is header, 1 is detail and 2 is footer. Basically, you need to keep the count increasing while reading detail records and compare the count with footer record's count. Ray has given some ideas too.
Just as a FYI. I used this kind of files in the past where we check the files and load a table with a flag whether the file meets the expectations to be processed. Then we read the table and then process the files whose entry has flag Y in that table. This also helped us to troubleshoot.
Kandy
_________________
Try and Try again…You will succeed atlast!!
_________________
Try and Try again…You will succeed atlast!!