View previous topic :: View next topic
|
Author |
Message |
pingte
Active User
Joined: 03 Dec 2005 Posts: 120 Location: india
|
|
|
|
I have a database structure like this..
A
|
v
B
|
v
C
I need to sequentially read this database:
I wrote the following calls...
GN on segment A until END OF SEGMENT A
GNP on B unitl END OF SEGMENT B
GNP on C until END of SEGMENT C
Problem faced:
First time it reads fine. i.e first occurence of B under A is read fine. All occurences of C is also read fine.
But when, END of C is reached and again contol returns to do a GNP on B, it gives GE and does not return the next occurence of B under A.
Can anyone help me with this loop! |
|
Back to top |
|
|
Douglas Wilder
Active User
Joined: 28 Nov 2006 Posts: 305 Location: Deerfield IL
|
|
|
|
You could just do a GN on A, B & C and get all 3 at the same time.
This would be done with 1 loop instead of 3 nested loops (I think that is what you meant to show). This would be more efficient.
Or you could use 3 different PCBs |
|
Back to top |
|
|
dominickim
New User
Joined: 28 Feb 2007 Posts: 65 Location: NS, CA
|
|
|
|
It looks like you used QSSA. If you specified QSSA on "B" level, then GNP with QSSA is acting like that. |
|
Back to top |
|
|
Srileka
New User
Joined: 21 Jun 2007 Posts: 19 Location: India
|
|
|
|
Hi,
Basically a GNP call should always be preceeded by a GN or GU call because a GNP cannot establish the parentage.
Your GN call will set the parentage at A. So GNP for B will fetch all ocurences of B with A as parent. And this GNP will not set the parentage to B for issuing GNP for C. The parent is still A. So you will get all the occurences of C with A as parent. It cannot limit the fetch of C with parent as each occurence of B. That is why at the end of C you get GE instead of fetching the next occurence of B.
Now let us see how to get the expected result.
Procedure 1:
1) GN call for A
2) GNP call for B
3) GNP call for C with 2 SSAs as below
segmentB *U
segmentC
* at position 9
The command code U will set the parentage at B. So the GNP call for C will limit the search for C with parent as that particular occurence of B.
But using command codes is not advisable always if you consider performance.
In that case follow this.
Procedure 2:
1) GN call for A
2) GNP call for B
3) GN call for C with qualified SSA's for A and B and unqualified SSA for C i.e get the key from A and B and qualify those segments and then call segment C.
Please let me know if you need more info.
Thanks,
Srileka.V |
|
Back to top |
|
|
|