Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

IMS DB/DC Last Root segment Fetch

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> IMS DB/DC
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    Post subject: IMS DB/DC Last Root segment Fetch
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    Post subject:
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    Post subject: Reply to: IMS DB/DC Last Root segment Fetch
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    Post subject:
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    Post subject:
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    Post subject: Reply to: IMS DB/DC Last Root segment Fetch
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    Post subject:
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    Post subject: Reply to: IMS DB/DC Last Root segment Fetch
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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Wed Feb 10, 2010 9:08 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Wed Feb 10, 2010 10:47 pm    Post subject: Reply to: IMS DB/DC Last Root segment Fetch
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    Post subject:
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    Post subject: Reply to: IMS DB/DC Last Root segment Fetch
Reply with quote

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

Site Director


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

PostPosted: Thu Feb 11, 2010 9:57 am    Post subject:
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    Post subject: Reply to: IMS DB/DC Last Root segment Fetch
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> IMS DB/DC All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Multi row fetch - "for read only... Nileshkul DB2 3 Sun Aug 14, 2016 12:52 am
No new posts JCL to fetch schedule status from act... parasmalik20 CA Products 1 Thu Jun 02, 2016 7:11 pm
No new posts ABEND due to FETCH FAILED jackzhang75 ABENDS & Debugging 17 Thu Mar 10, 2016 3:08 am
No new posts Sort Query to fetch particular records RahulG31 DFSORT/ICETOOL 13 Fri Mar 04, 2016 8:17 pm
No new posts Fetch the latest record from a table ... maxsubrat DB2 8 Tue Dec 01, 2015 7:13 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us