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

How to retain the parentage for successive IMS calls?


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

New User


Joined: 11 Dec 2006
Posts: 35
Location: India

PostPosted: Mon Aug 06, 2007 10:41 pm
Reply with quote

Hi,

My IMS DB structure is as follows.
Order
- Item
- Message
where Order is root segment and Item, Message are both child segments of Order.

My program currently reads all Messages of an order using GNP calls in a loop & setting the parentage at Order.

For a new requirement, before doing the above process of reading all messages of an order, i need to read all the items of the order, process them & update a field in Order segment. So i am inserting the following calls before reading Messages -
1. Make a GU call to fetch the 1st item of the order by setting the parentage at Order.
2. Make GNP calls successively to fetch all items of the order and process.
3. Update the field in Order segment using GHU & REPL successively.

Now my questions are

1. How will the existing calls for reading message segments of the order work as the parentage would have been cancelled / lost by GHU call i made?
2. Or do i need to make another GU call with parentage at Order after REPL call?
3.Is there any other way to achieve this with out affecting the existing calls?
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


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

PostPosted: Tue Aug 07, 2007 4:13 am
Reply with quote

Use multiple positioning. Set up your PSB with 2 views of the order. Use the first PCB to do your sequential processing. Then use the 2nd PCB to do your qualified GHU and subsequent REPL.
Back to top
View user's profile Send private message
rajabhushanam.y

New User


Joined: 12 Jul 2007
Posts: 11
Location: Mysore

PostPosted: Tue Aug 07, 2007 3:20 pm
Reply with quote

Hi , why don't you use set the parentage ,before using the call ( p . path command) , it is my thinking only.

Cheers,
Rajabhushanam.y
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


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

PostPosted: Tue Aug 07, 2007 4:57 pm
Reply with quote

Hi rajabhushanam,

There is absolutely no reason to issue path calls. As a matter of fact, it would be a lot more tricky. When getting a not found, you would then need to interrogate the keyfeedback area for last successful retrieval. Your POSITION would then be lost. Remember that in IMS, you are positioned at your last successful call. Using a qualified root, unqualified child ssa calls on your first PCB1 - then retrieving the parent with a qualified call on PCB2 would do the trick. When setting up your PSB - make sure PCB1 only allows get calls and PCB2 allows update calls.
Back to top
View user's profile Send private message
Karthigaiselvan

New User


Joined: 11 Dec 2006
Posts: 35
Location: India

PostPosted: Mon Aug 13, 2007 11:10 pm
Reply with quote

Hi,

Thanks for all the replies. Though Multiple Positioning should work out for this case, we settled with a simple option of making another GU call with parentage command after processing the Item segments and before reading the Message segments.
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 Aug 13, 2007 11:14 pm
Reply with quote

Why are you setting parentage? Did I miss something?
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: Tue Aug 14, 2007 1:05 pm
Reply with quote

Well may be command codes are used icon_rolleyes.gif
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


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

PostPosted: Tue Aug 14, 2007 4:14 pm
Reply with quote

Yes, "D", but why?
Back to top
View user's profile Send private message
Karthigaiselvan

New User


Joined: 11 Dec 2006
Posts: 35
Location: India

PostPosted: Wed Aug 29, 2007 10:34 pm
Reply with quote

Hi Sandy,

We set the parentage by command code 'P' right? D is for a path call.

The reason why i had to set the parentage was -
There were successive GNP calls already coded to read Messages of an order, I had to insert my new changes to process Items of an order before GNP & after 1st GU of root segment (Order). Please refer my 1st post for more details. So for GNP calls that follow my changes, i need to set the parentage as the parentage set earlier would be lost becasue of GHU made befroe that. Does that make sense?
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


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

PostPosted: Wed Aug 29, 2007 11:05 pm
Reply with quote

You are correct about the command code. There are always multiple ways to do calls. If you want to leave the code as is and it is correct and efficient - then go for it!

I always like to think of the person maintaining or enchancing something I have done. Please tell me again why you need to set parentage? Can you accomplish the same thing with mulitple qualified ssa's beneath that parent?
Back to top
View user's profile Send private message
Karthigaiselvan

New User


Joined: 11 Dec 2006
Posts: 35
Location: India

PostPosted: Wed Aug 29, 2007 11:55 pm
Reply with quote

Beneath the parent (order), i had to access ALL Item & Message segments (child) in sequence. So i can not use qualified SSAs for accessing the child segments under the parent.

I am not sure about the advantage of Multiple Qualified SSA. Could you please explain me this with an example?
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


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

PostPosted: Thu Aug 30, 2007 12:22 am
Reply with quote

Yes - you can use qualifed and non qualified SSAs to retrieve child segments. I am assuming that Item and Message are 2nd level child segments beneath an order. If the message turns out to be a child segment beneath the ITEM, it is easy to change the code. Take a quick look at your DBD.

1. GU call for ORDER segment - Qual SSA for ORDER. If you are going thru a database sequentially retrieving all ORDERs, then just load the retrieved ORDER number into the qualifed SSA for the ORDER that you have.

1.1. Perfrom a routine that will GN call for ITEM segment - Qual SSA for ORDER, Unqual SSA for ITEM- until no more ITEM segments for that ORDER - could be 1 - could be many. Check IMS status code for blanks after each call.

1.2. Perfrom a routine that will GN call for MESSAGE segment - Qual SSA for ORDER, Unqual SSA for MESSAGE - until no more MESSAGE segments for that ORDER- could be 1 - could be many. Check IMS status code for blanks after each call.
Back to top
View user's profile Send private message
Karthigaiselvan

New User


Joined: 11 Dec 2006
Posts: 35
Location: India

PostPosted: Thu Aug 30, 2007 6:38 pm
Reply with quote

Ok. I understand that.
Items & Messages are 2nd level child segments only.

But in the existing code, there is already GNP call coded for retrieving Message segments. If i dont want to disturb that, then i can not go with option you suggested right? So I am setting the parentage since the GNP call will expect an estabilished parentage. That's working.

I also understand that even if i make a simple GU call for ORDER (before GNP for message)with no command code 'P', it will work out.
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


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

PostPosted: Thu Aug 30, 2007 7:25 pm
Reply with quote

Are you thinking that by setting parentage, that you are still positioned on the root segment - the order? Just remember that you are always positioned on your last successful call.

Are you using any SSA when retrieving your child segments? If you are not using an SSA when retrieving the child segments, you will most likely be checking for "GA" and "GK" - which indicates that you have made a sucessful call but you have retrieved that you have now retrieved a different segment type. Also, if parentage has not been set, GNP should not be executed - if it is, no segment will be retrieved and you will get a return status code "GP".

I like to control where I am by using the example I gave. I also like the most straight forward, easiest way to maintain and enhance the program. I cannot understand why not use the easiest method. I do not - at this time - understand why setting parentage is important?
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: Sun Sep 02, 2007 9:40 pm
Reply with quote

Multiple PCS's are costly. Command codes may help out like the V-code. Some searching and reading might help like 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 COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts JAVA equivalent for IMS DL/I calls IMS DB/DC 2
No new posts SORT BUT RETAIN HIGHEST VALUE ON NON-... DFSORT/ICETOOL 2
No new posts CICS Roll back partially - Need to re... CICS 4
No new posts Sending system service calls by AIBTDLI. IMS DB/DC 1
Search our Forums:

Back to Top