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

Question on GNP Call


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

New User


Joined: 21 Jun 2007
Posts: 19
Location: India

PostPosted: Sat Feb 21, 2009 5:06 pm
Reply with quote

Hi,
I have a database with the below structure.
Root
|
Policy
|
Overflow

I tried to read all the overflow segment occurences for each policy segment occurence. For this i had GNP call (unqualified SSA) to policy segment withing a loop. For each successful retrieval of policy segment I had a loop to call all its overflow segments. Here i used GNP (unqualified SSA).

Problem is, I had only one overflow occurence, but the loop for overflow segment gave successful retrieval twice. When checked the PCBMASK, first iteration seems to move from level 02 to 03 (got the first occurence of overflow), in the second iteration segment levels before and after call is 03 and i got the same data again.

I expected that the second iteration would not fetch me the same record again and it should have given me a GE.

Note:
The GNP call in the loop for policy segment is retrieving properly. Its not repeating the fetch.

Srileka.V
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Sat Feb 21, 2009 6:09 pm
Reply with quote

Please post your code. And, why are you using GNP instead of qualifying your SSA down?
Back to top
View user's profile Send private message
Srileka

New User


Joined: 21 Jun 2007
Posts: 19
Location: India

PostPosted: Mon Feb 23, 2009 12:35 pm
Reply with quote

Hi,
The code worked after having U command code in XPOLSEG when calling the overflow segment.

XPOLSEG --> Policy segment name
XPOLOV1 --> Overflow segment name

DCL SSAOVPN CHAR(40) INIT('XPOLSEG *U');
DCL SSAOV1N CHAR(40) INIT('XPOLOV1');

CALL PLITDLI(FIVE,GNP,PCB,IOAREA2,SSAOVPN,SSAOV1N);

Coming to your question,
Do you want me to capture the key in the policy segment and use that when calling the overflow segment?
Like,

DCL SSAOVPN CHAR(40) INIT('XPOLSEG (XPOLYEAR=2008)');
DCL SSAOV1N CHAR(40) INIT('XPOLOV1');

CALL PLITDLI(FIVE,GNP,PCB,IOAREA2,SSAOVPN,SSAOV1N);

Sorry if my understanding is wrong.

Please clarify my below doubt,
1) In my case, I issued GNP calls in loop for segments at level 02, and for each successful retrieval of level 02 segment I issued GNP calls in loop for level 03 segments. Will the first GNP call set parentage for the second GNP call? Should GNP calls always issued after GN or GU calls only? Cant it preceed with a GNP call?
I believe command code U does the job of setting parentage when we want to issue GNP calls (for level 03) after a GNP(for level 02). Please let me know if my understanding here is wrong.

Thanks & Regards,
Srileka.V
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Mon Feb 23, 2009 6:04 pm
Reply with quote

If you have keyed parent segments there is no need for GNP and the use of command codes. You simply qualify the SSA statements above the segment you want and loop your child segment with an unqualified SSA.

Are you first reading all roots? Then are you reading all level 2 segments going after level 3 segments?
Back to top
View user's profile Send private message
Srileka

New User


Joined: 21 Jun 2007
Posts: 19
Location: India

PostPosted: Mon Feb 23, 2009 6:20 pm
Reply with quote

Yes. I am reading all the root segments in loop, at each successful retrieval of root am reading all its policy segments in loop and at each successful retrieval of policy segment am readng all its overflow segments in loop.
Is there any difference in performance when we use command codes and qualifying the SSA at higher levels? Basically i want to know why you prefer the second option than going with command codes. Our production code also doesnt use much of command codes. Instead they have followed whatever you stated above.

Thanks,
Srileka.V
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Mon Feb 23, 2009 6:34 pm
Reply with quote

When I first learned IMS, I too used command codes. Then I learned that the best way is always the most easily maintainable way - the most straightford approach. Try to stay away from command codes if you can. Also, it always helps to know what is the business purpose - there may be an easier way - and more efficient - to accomplish a request.

I know that I have the parent-child loop logic posted here somewhere. Here it is - in simple pseudo....

root - loop with unqualified SSA until GB - if not GB (spaces) - qualify your root SSA with the key from this root and do loop 2

loop 2 - use qualified root SSA and unqualified level 2 SSA and loop until GB or GE - if spaces - qualify level 2 SSA and do loop 3

loop 3 - use qualified root SSA and qualified level 2 SSA and unqualified level 3 SSA and loop until GB or GE

So, you will be reading all root segments - all level 2 segments under this root - and all level 3 segments under each root and level 2.
Back to top
View user's profile Send private message
Srileka

New User


Joined: 21 Jun 2007
Posts: 19
Location: India

PostPosted: Mon Feb 23, 2009 6:54 pm
Reply with quote

Sandy,
Thank you so much for the valuable info.

Regards,
Srileka.V
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 Question for file manager IBM Tools 7
No new posts Error while running web tool kit REXX... CLIST & REXX 5
No new posts Call program, directly from panel CLIST & REXX 9
No new posts question for Pedro TSO/ISPF 2
No new posts Batch call online program, EXCI task ... CICS 3
Search our Forums:

Back to Top