View previous topic :: View next topic
|
Author |
Message |
roy_robi
New User
Joined: 25 Dec 2006 Posts: 4 Location: chicago
|
|
|
|
What is the difference between GU, GN and GNP? Can someone explain it with an example?
In a database if I use GU I will get only one segment.
If I want every segment then I use GN and process each segment.
But what about GNP? ( instead of using this I can use GN but qualified it upto it's parent)
I would appreciate if you give an example.
Thx,
Robi
Title changed from "CALL Functions" to "What is the difference between GU, GN and GNP?" : Priyesh. |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Robi... Pls go thru FORUM Rules on to make a good posting...
Quote: |
What is the difference between GU, GN and GNP? Can someone explain it with an example? |
let's have an example...
Root => Student
1st Child => Course
2nd Child => Exams
If you want to find out information for student "Robi" you would give a GU call at root segment with KYVAL passed as "Robi".
If you want to get information for all the students from the root segment, you would issue a GN call at root segment with passed nothing; UNTIL EoS (end of segment).
If you want to get all the course details for all the students.
1> GN Call (as per above) until EoS.
2> within each GN Call, GNP on Course segment until EoS.
Quote: |
In a database if I use GU I will get only one segment. |
In a segment if I issue GU, I'll get only one occurrence.
Quote: |
If I want every segment then I use GN and process each segment. |
Read it as "occurrence" instead of "segment".
Quote: |
But what about GNP? ( instead of using this I can use GN but qualified it upto it's parent) |
Could you make it more clear... |
|
Back to top |
|
|
roy_robi
New User
Joined: 25 Dec 2006 Posts: 4 Location: chicago
|
|
|
|
Thanks Priyesh. This was my first posting.
I see your example. Now could you please explain when and how I should use GNP call.
I have seen GNP call but do not understand the difference between GN and GNP call. If you want to access Get Next Parent (GNP) then why not use GN in the parent level?
Thanks in advance.
Robi |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi Robi,
GNP : Get next in the parent..
A GNP call retrieves segments sequentially. The difference between a GN and a GNP is that GNP limits the segments that can satisfy the call to the dependent segments of the established parent.
An unqualified GNP retrieves the first dependent segment occurrence under the current parent. If your current
position is already on a dependent of the current parent, an unqualified GNP retrieves the next segment occurrence.
If you are moving forward in the database, even if you are not retrieving every segment in the database, you can use GNP to restrict the returned segments to only those children of a specific segment.
lets take an example...
I have a database where PDTLSEG(policy detail segment) is the root segment PTRANSEG & POCCDSEG is child of PDTLSEG & PANALSEG is child of PTRANSEG .
Now if i want to retrieve all the PANALSEG that belongs to particular policy & TRansaction then i have to set parentage by issuing a qualified GU call
for that PTRANSEG under that PDTLSEG.Then if i issue GNP until End of database i will able to get all PANALSEG But if i issue GN then i will get POCCDSEG also which i dont require.
Hope it will helpful |
|
Back to top |
|
|
sreekarreddyg
New User
Joined: 22 Apr 2006 Posts: 2
|
|
|
|
Hi Robi,
The definition for GNP is Get Next within the Parent and not Get Next parent as written by u in the above. |
|
Back to top |
|
|
Bitneuker
CICS Moderator
Joined: 07 Nov 2005 Posts: 1104 Location: The Netherlands at Hole 19
|
|
|
|
It's a while ago TS wrote to us but if he/she ever gets back to this topic I suggest some reading over here. |
|
Back to top |
|
|
|