There is a database in IMS for Clients, and same info is loaded in a DB2 Database. The Key is Indexed in DB2 table.
Now I have to write a code which would need data for the client, so I can do either making a qualified call to IMS as I will be having the keys. Or I can make a DB2 call, where the key columns are indexed. There would be around 30,000 keys to be searched.
If someone could please suggest which call would be better ( IMS/DB2) in terms of data access and data retrieval and more efficient, the code will be written in COBOL.
If you know the child key then always qualified IMS calls are faster but if it is just a 30k of records/rows then the response time would make no great impact when you make a use DB2 or IMS unless the total Hits/day is significant.
Joined: 22 Apr 2006 Posts: 6258 Location: Mumbai, India
There is more than what meets the eyes, in this question and probably that is significant enough that I've compiled a reply for it couple of days back and then decided not to post it.
Well - said that, you need to consider couple of things here -- first, why do they maintain two different database for exactly the same information? What business purpose does it serve?
I had been to a client who were maintaining such two separate databases and they were reluctant to tell about it (It's not easy to work as a vendor!). Upon close investigation I came to know that the IMS gets update first and then they just replicate DB2 from IMS (which means these two DBs don't have two different source of information, which might be compared later -- so in both the DBs the information was essentially the same and if IMS was wrong DB2 is wrong anyways! A total waste of resources). When as vendor I argued that I'd not like to update the DB2 counter part of the system for any future release they opened up and said, we had a database conversion project but it failed and we did not transfer everything to DB2 -- so we don't rely on DB2 output but if you can keep them going together as much as possible, it'll be nice!
Long story short -- does your shop have future perspective to continue with IMS? IMS DB does not have a complex child-parent relationship? You need a similar setup as it exist today and no intentions to move away from IMS? Then probably IMS is the choice.
As you know, IMS is a hierarchical which means that parent-child relationships are faster for sequential traversing. For example, if you need all children for parents whose ages are between 30 and 40. A relational database system cannot automatically satisfy such a request by the nature of the table structure. It must be done using program code of SQL joins and its siblings.
However, given the same scenario and if you wanted to find all children with age between 5 and 15, DB2 is much easier to use (and probably will be efficient enough too ) as it only needs to maintain position in the child table and does not have to traverse the tree back up to find the parent table (key). And so DB2 should be a choice.
For the last two paragraphs - you, as a programmer, can have some answers however for other thoughts, you, as an individual, can not have much say -- those decisions are at enterprise level and you can only know them and act accordingly.
We actually have that situation, but it's on purpose. We unload IMS and load DB2. The reason is to provide ad hoc reporting ability to users via SQL connectors.
If I were a betting man, I would bet on IMS being actually a BIT faster. For 30,000 lookups, I think it will be hard to measure the difference. However, I think that your points about the proper choice are acually much more important.