IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

IMS DB/DC Last Root segment Fetch


IBM Mainframe Forums -> IMS DB/DC
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shyam k dhanraj

New User


Joined: 18 Jun 2008
Posts: 27
Location: bangalore

PostPosted: Wed Feb 10, 2010 2:57 pm
Reply with quote

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
View user's profile Send private message
kirankumart

New User


Joined: 04 Aug 2009
Posts: 10
Location: Hyderabad

PostPosted: Wed Feb 10, 2010 5:57 pm
Reply with quote

Hi Shyam,

Quote:
Last root segment


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
View user's profile Send private message
shyam k dhanraj

New User


Joined: 18 Jun 2008
Posts: 27
Location: bangalore

PostPosted: Wed Feb 10, 2010 6:04 pm
Reply with quote

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
View user's profile Send private message
kirankumart

New User


Joined: 04 Aug 2009
Posts: 10
Location: Hyderabad

PostPosted: Wed Feb 10, 2010 6:14 pm
Reply with quote

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
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Wed Feb 10, 2010 6:15 pm
Reply with quote

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
View user's profile Send private message
shyam k dhanraj

New User


Joined: 18 Jun 2008
Posts: 27
Location: bangalore

PostPosted: Wed Feb 10, 2010 6:26 pm
Reply with quote

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
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Wed Feb 10, 2010 6:30 pm
Reply with quote

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
View user's profile Send private message
shyam k dhanraj

New User


Joined: 18 Jun 2008
Posts: 27
Location: bangalore

PostPosted: Wed Feb 10, 2010 6:40 pm
Reply with quote

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
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Wed Feb 10, 2010 6:42 pm
Reply with quote

You are doing this ONLINE? WHY?
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Wed Feb 10, 2010 6:44 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Feb 10, 2010 9:08 pm
Reply with quote

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
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Wed Feb 10, 2010 9:12 pm
Reply with quote

Hi Dick! Do they have a "control" database? I wondered that too. That would be a separate database.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Feb 10, 2010 10:47 pm
Reply with quote

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 icon_smile.gif

d
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Wed Feb 10, 2010 10:58 pm
Reply with quote

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
View user's profile Send private message
shyam k dhanraj

New User


Joined: 18 Jun 2008
Posts: 27
Location: bangalore

PostPosted: Thu Feb 11, 2010 9:53 am
Reply with quote

Whats a control database?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Feb 11, 2010 9:57 am
Reply with quote

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
View user's profile Send private message
shyam k dhanraj

New User


Joined: 18 Jun 2008
Posts: 27
Location: bangalore

PostPosted: Thu Feb 11, 2010 10:16 am
Reply with quote

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
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Tue Feb 16, 2010 12:44 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> IMS DB/DC

 


Similar Topics
Topic Forum Replies
No new posts Fetch data from programs execute (dat... DB2 3
No new posts Code Multi Row fetch in PL1 program PL/I & Assembler 1
No new posts Need to fetch data from so many DB2 t... DB2 9
No new posts IMS SEGMENT READ ISSUE IMS DB/DC 1
No new posts fetch the record number from FMNMAIN ... CLIST & REXX 10
Search our Forums:

Back to Top