View previous topic :: View next topic
|
Author |
Message |
shyam k dhanraj
New User
Joined: 18 Jun 2008 Posts: 27 Location: bangalore
|
|
|
|
I want to fetch the Last root segment from a HIDAM database. IMS disregards the L command code when used for a root segment. Is there any way to fetch the last root segment without fetching the other segments. |
|
Back to top |
|
|
kirankumart
New User
Joined: 04 Aug 2009 Posts: 10 Location: Hyderabad
|
|
|
|
Hi Shyam,
Did you mean last occurance of the root segment. Be specific, when you call the segment with commad code 'L' then you should get the last occurance.
Show the code how you are making a call to the root segment. |
|
Back to top |
|
|
shyam k dhanraj
New User
Joined: 18 Jun 2008 Posts: 27 Location: bangalore
|
|
|
|
I want to fetch the Last root segment. If I am not wrong, root segment type cannot have segment occurences.
I have a unique key constraint on the root segment. Assume that I have a root segment which has a root key varying from 0000001 to 1000000. I want to fetch the segment that has the greatest key value.
In SQL terms, I want a DLI call that can do a SELECT MAX(col1) from tabl1;
Since its a HIDAM database, the MAX key will be the last root segment, so i want to fetch the last root segment. |
|
Back to top |
|
|
kirankumart
New User
Joined: 04 Aug 2009 Posts: 10 Location: Hyderabad
|
|
|
|
Shyam,
Every segment will have the occurances irrespective of root or child. You said that root key is avrying from 1 to 1000000, here every unique key will be an occurance.
Try to make call to root segment with the command code 'L'. And let us know the result. |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
First of all - we don't do FETCH in IMS. And, IMS works completely differently from DB2 - SQL. You need to put together a boolean SSA. |
|
Back to top |
|
|
shyam k dhanraj
New User
Joined: 18 Jun 2008 Posts: 27 Location: bangalore
|
|
|
|
Kiran,
As I have already mentioned an 'L' Command code will not work for root segments. It is given in the mauals and I have tried that as well.
Sandy,
I am aware of boolean SSA, but I am really not able to come up with an SSA that always gets me the root segment occurence with the maximum key value.
If you guys have a suggestion on how to approach the problem, please let me know. |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
Why do you need the last root? Is it the key value you want? How large is the database? You could use an unqualified SSA for the root and read thru the database until you get to the end - GB. You can then look at the key feedback area in your PCB for the value of the last key. |
|
Back to top |
|
|
shyam k dhanraj
New User
Joined: 18 Jun 2008 Posts: 27 Location: bangalore
|
|
|
|
Sandy,
I want the key value. The database is huge so I really cannot afford to read thru all the segements until stats = GB. Also, this is for an online application and hence the response time is critical. |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
You are doing this ONLINE? WHY? |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
Your tech services area - specifically your IMS DBA should be able to tell you. They have nifty little tools. But, why do you need that last key value? Is this ongoing? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
But, why do you need that last key value? |
Possibly to add one to it to create a "new" "last key". . .
If this is the case, i'd probably go with a "next available" value in a control record. . . |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
Hi Dick! Do they have a "control" database? I wondered that too. That would be a separate database. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hi Sandy,
Quote: |
Do they have a "control" database? |
Sounds like this is an attempt to get the same result without implementing the control data. . .
Possibly, i completely misunderstand
d |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
Well, if they need an "online" function that they will continually access to find out the last key field in an IMS database, they should have designed the system to include a little bitty control database. It's not too late!!! If it is critical, they can add it - then all they need to do is issue 1 call and they've got it! |
|
Back to top |
|
|
shyam k dhanraj
New User
Joined: 18 Jun 2008 Posts: 27 Location: bangalore
|
|
|
|
Whats a control database? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Something that could contain "control" information - such as the "next available number" for a process that needs to add a new entry based on which value is available next. . .
This is much better than trying to find the "last" or "highest" value already stored and assigning the next value. |
|
Back to top |
|
|
shyam k dhanraj
New User
Joined: 18 Jun 2008 Posts: 27 Location: bangalore
|
|
|
|
If I my understanding is correct, the control database is an IMS Database that has only one root segment occurence to store the highest key value alone. I also believe that, in the application when a segment is inserted to the normal database , it should also do a REPL on the control segment. Am I correct? Is there any guidelines that one should follow to create a control database? |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
A control database is a database that you can use to "control" your system. For instance, if you have something you are doing online to detect at which point you are in your daily process - like data entry - end of day - settlement - etc, you will have a control database. You can also use a control database to keep track of the beginning and ending keys in your databases within your system. Then each time you would want to find the first and last key in a particular database within your system, you would make a call to your control database. |
|
Back to top |
|
|
|