Author: Abid Hasan
Posted: Thu May 12, 2016 11:18 am (GMT 5.5)
Hello,
If it is just comparison of data you're looking for - and you want to use COBOL - doable; but requires quite a bit of coding, and a condition miss here and there, the whole thing can fall apart.
Make sure your input records are SORTed - and SORTing is done on the keys which can act as unique identifiers between both files, such as your report identifier AND acct number (if you have it) - basically the idea is to prepare an input file which would have records in either of them in sequence.
Once you have the two input files ready, now comes the bigger task at hand - writing your COBOL prog.
Use a 2 file-balancing/file-matching logic, to balance both files. Since you have a fixed length of 100 bytes, that makes life easy. Read the input file into a 100 byte record, using reference modification test your record-id, basis the same MOVE the read record into the layout you need. Once you have the data moved into a layout - rest is easy breeze.
Points to remember:
a. The records MUST-AND-MUST be sorted on correct keys prior balancing/matching.
b. You NEED to ensure that there are NO RECORD DROPs during balancing, which is a very common error while writing a matching/balancing logic.
c. End-of-file handling for both files.
For beginner's, I remember Mr. Scherrer sharing a well written and tested code for file matching/balancing on the forum; use it as a reference starting point and build your logic around itl; or use Google to first understand the concept of balancing files. Once you get a hang of it, you'll realize it is a very powerful and handy algorithm if-done-right.
If you face issues, share your code and we can tweak it further.
Hope this helps.
Edit: On an afterthought, if the source that generates these files, is driving the process from VSAM files and building them (which I am assuming will be the case here), then it'd be safe to assume that the data is pre-sorted on keys, and you can jump to balancing minus SORTing (though - do verify this point).
_________________
Thanks.
Posted: Thu May 12, 2016 11:18 am (GMT 5.5)
Hello,
If it is just comparison of data you're looking for - and you want to use COBOL - doable; but requires quite a bit of coding, and a condition miss here and there, the whole thing can fall apart.
Make sure your input records are SORTed - and SORTing is done on the keys which can act as unique identifiers between both files, such as your report identifier AND acct number (if you have it) - basically the idea is to prepare an input file which would have records in either of them in sequence.
Once you have the two input files ready, now comes the bigger task at hand - writing your COBOL prog.
Use a 2 file-balancing/file-matching logic, to balance both files. Since you have a fixed length of 100 bytes, that makes life easy. Read the input file into a 100 byte record, using reference modification test your record-id, basis the same MOVE the read record into the layout you need. Once you have the data moved into a layout - rest is easy breeze.
Points to remember:
a. The records MUST-AND-MUST be sorted on correct keys prior balancing/matching.
b. You NEED to ensure that there are NO RECORD DROPs during balancing, which is a very common error while writing a matching/balancing logic.
c. End-of-file handling for both files.
For beginner's, I remember Mr. Scherrer sharing a well written and tested code for file matching/balancing on the forum; use it as a reference starting point and build your logic around itl; or use Google to first understand the concept of balancing files. Once you get a hang of it, you'll realize it is a very powerful and handy algorithm if-done-right.
If you face issues, share your code and we can tweak it further.
Hope this helps.
Edit: On an afterthought, if the source that generates these files, is driving the process from VSAM files and building them (which I am assuming will be the case here), then it'd be safe to assume that the data is pre-sorted on keys, and you can jump to balancing minus SORTing (though - do verify this point).
_________________
Thanks.