Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Merging files

Status
Not open for further replies.

MICKEYMELNICK

IS-IT--Management
May 24, 2002
3
US
Is there a way to merge two isam files? One file contains history prior to May 2002 and the other files contains history after and including May 2002. They are the same files with the same type of information just with different date histories.
 
Mickey,
See if faq209-1109 helps. If not, get back to us.
Marc
 
Rather than writing a program, why not use a product like SYNCSORT to do the merge? Also, if you have Easytrieve Plus, he'll do about the same thing and will give you a report if you want it.

I'm not sure what either of these products will do with an ISAM file. You may have to repro them down to two flat files, merge them to a third file, , then repro them back to an ISAM file. Or just forget the whole ISAM thing and go to a KSDS file, which is where you should probably be anyway.
 
I would have thought the simplest, quickest, cheapest and safest way would be to write a simple COBOL program to so it. It should take less than a day, and less than 50 lines of code. Only if the files are huge (millions of records) would it take very long to run.

This would result in a tidy clean file.

You would need to: OPEN file1, READ file1, WRITE file3, loop back up to read file 1 until end of file, close file1, and repeat for file2, etc.

Phil Hickling,
 
Depends if the 2nd file is appended to the first or acutally 'merged'. The queston doesn't state what the index key is. Perhaps it's customer number not date. So, the merged file woudl have cust 1, date1, date2....cust2, date1, date2.

What we do know is that both files contain May data. Are they dup records. We don't know. Are we supposed to kick-out dups? I would suppose so. I know zip about isam, but if it deals with unique indexes, then logic in a program is going to have to detemine when a dup condition exists and do something with the dup records.

If it's a merge, then one file is going to have to be considered the master and one the transaction, as the indication to look at the faqs implies.

All this would be much more complex coding than read / write, and would require presorting the files in some order that would faciliate the type of logic in fhe faqs mentioned.

Using Syncort in this case would be much simpiler.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top