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

What is the difference between GU, GN and GNP?


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

New User


Joined: 25 Dec 2006
Posts: 4
Location: chicago

PostPosted: Wed Dec 27, 2006 1:40 am
Reply with quote

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

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Wed Dec 27, 2006 2:04 am
Reply with quote

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

New User


Joined: 25 Dec 2006
Posts: 4
Location: chicago

PostPosted: Wed Dec 27, 2006 2:21 am
Reply with quote

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

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Wed Dec 27, 2006 9:55 am
Reply with quote

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

New User


Joined: 22 Apr 2006
Posts: 2

PostPosted: Sat Jan 20, 2007 7:17 pm
Reply with quote

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

CICS Moderator


Joined: 07 Nov 2005
Posts: 1104
Location: The Netherlands at Hole 19

PostPosted: Mon Jan 22, 2007 2:53 pm
Reply with quote

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
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 Timestamp difference and its average ... DB2 11
No new posts Difference when accessing dataset in ... JCL & VSAM 7
No new posts What is the difference between Taskty... Compuware & Other Tools 2
No new posts Difference between VALIDPROC and CHEC... DB2 3
No new posts Difference between CEE3250C and CEE3204S COBOL Programming 2
Search our Forums:

Back to Top