View previous topic :: View next topic
|
Author |
Message |
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
There are a couple of ways to do this. The easiest and most straightforward is to use the qual SSA for the parent and unqual SSA for the child. When you get either "GE" - end of child segments or "GB" - end of database, you know that you have read the last segment.
As you were looping thru those segments, your child segment was returned into your IO area. Your IO area will contain the data from your last successful call. |
|
Back to top |
|
|
narasimha.g
New User
Joined: 10 Sep 2009 Posts: 68 Location: Liverpool
|
|
|
|
Sandy Zimmer wrote: |
There are a couple of ways to do this. The easiest and most straightforward is to use the qual SSA for the parent and unqual SSA for the child. When you get either "GE" - end of child segments or "GB" - end of database, you know that you have read the last segment.
As you were looping thru those segments, your child segment was returned into your IO area. Your IO area will contain the data from your last successful call. |
ohh k... thanks for this.. It ll be very much helpful to me... as i was reading the child till end of child segments and in each read i used to replace the old values with new values in temperory variables... |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
You can also move your IO data to a "saved" IO child segment after each successful read. Then replace the old values with the new values before your insert. |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
One more thing you need to think about. What if there are no child segments? Is there enough data on your input file to populate that first child segment? |
|
Back to top |
|
|
nareshkp
New User
Joined: 26 Sep 2007 Posts: 28 Location: Bangalore
|
|
|
|
You can also think about using command code L to retrive the last occurance of the child segement directly... |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
Quote: |
You can also think about using command code L to retrive the last occurance of the child segement directly... |
I said simple and straightforward. Always program so that your code is easily maintainable - think of that next person. |
|
Back to top |
|
|
Ajay Baghel
Active User
Joined: 25 Apr 2007 Posts: 206 Location: Bangalore
|
|
|
|
Quote: |
said simple and straightforward. Always program so that your code is easily maintainable - think of that next person. |
But i read somewhere, that each DLI call is costly. So we should try saving dli calls.
Yes, but when it comes to maintainability, I am not very sure how the command code would be interpreted if there is a change in underlying database organisation, especially if underlying database is a HS (Hierarchical sequential) database, given that it does not use pointers. |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
What do you think IMS is doing behind the scenes? That database org will not be changing to HS - take my word.
Try it anyway you can think of - then pick the best. |
|
Back to top |
|
|
|