A few queries on IMS-DB



IBM's hierarchical database management system with a Database Manager (IMS DB) and a Transaction Manager(IMS DC)

Re: A few queries on IMS-DB

Postby Sandy Zimmer » Mon Jul 21, 2008 3:31 pm

It would be great if you could actually run your program. The best way to learn is to actually do it - make some mistakes and learn from them. Do not forget that you are done with the entire process when you have all the segments for Organization name=NIIT & Department-ID=DEPT1.
Sandy Zimmer
 
Posts: 28
Joined: Mon Jul 30, 2007 8:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: A few queries on IMS-DB

Postby ritwik.das » Wed Jul 23, 2008 4:33 pm

Hi Dick and Sandy!

Sorry for the delay. I've uploaded a .txt version of the relevant portion of the DB Structure that I was using. Hope this time you will be able to see it.

Sandy, your explanation is very helpful in understanding the way IMS works. However you possibly dealt with calls with no SSA-s (".....and do not use any SSA in your calls"), My code uses two unqualified calls. The outer GN is unqualified for employee (to read all the employees for DEPT1) and the inner one is unqualified for dependants (to read all dependants for a particular employee of DEPT1).Will your explanation be equally applicable here?

Thanks & Regards!
Ritwik
You do not have the required permissions to view the files attached to this post.
Thanks & Regards!
Ritwik
ritwik.das
 
Posts: 13
Joined: Wed Jul 16, 2008 10:27 am
Has thanked: 0 time
Been thanked: 0 time

Re: A few queries on IMS-DB

Postby Sandy Zimmer » Wed Jul 23, 2008 5:46 pm

Ritwik, Your application dictates how you code the calls. I have dealt with all situations. Let's do a little psuedo code...

You know the org and dept - the SSA for both will be qualified - you will have a loop until you get a GE or GB - if you get a GE while executing this loop, you need to check the segment level and concatenated key in your PCB to determine what key. If you no longer have the org or dept that you want, you are done.

ORGANIZATION | _ There can be many other root segments.
|
v
DEPARTMENT | There can be many child department segments under each org.
|
v
EMPLOYEE | This will be your main loop. You will use the org and dept qualified and GN your employee segments. When you have a successful call, you will then build your qualified SSA for employee and execute your loop to retrieve all dependant segments for this particular employee. There may one employee or 500 employee - how ever many are on the database.
|
v
DEPENDANTS | When you get a GB or GE, return control back to the employee loop. Use an unqualified SSA to get your next employee.
Sandy Zimmer
 
Posts: 28
Joined: Mon Jul 30, 2007 8:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: A few queries on IMS-DB

Postby ritwik.das » Fri Jul 25, 2008 10:26 am

I've got iy finally. Thanks a ton Sandy for your explanation! It encompasses all the scenarios possible. I think I'll have to refer back to your explanations repeatedly in case a doubt arises in future.
Thanks & Regards!
Ritwik
ritwik.das
 
Posts: 13
Joined: Wed Jul 16, 2008 10:27 am
Has thanked: 0 time
Been thanked: 0 time

Re: A few queries on IMS-DB

Postby Sandy Zimmer » Fri Jul 25, 2008 6:43 pm

An easy way - always - is to draw youself a picture - a logic flow. For instance, draw a flow of where you are positioned after each call using different database scenarios. For instance - employee1 with 10 dependents - employee2 with no dependents - employee3 with 3 dependents. Don't forget when the org and/or dept changes.
Sandy Zimmer
 
Posts: 28
Joined: Mon Jul 30, 2007 8:10 pm
Has thanked: 0 time
Been thanked: 0 time

Previous

Return to IMS DB/DC