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

IMS DB : Updating a field in Child Segment.


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

New User


Joined: 16 May 2008
Posts: 6
Location: bangalore

PostPosted: Mon May 19, 2008 11:05 am
Reply with quote

Hi,

Our IMS database looks like this.

Parent(IMS root)
CHild1
child 2
child 3

all child 1,2,3 are child segment of parent segment.

1. Now our PSB has definition for parent and child 3.We are not concerned about child 1 and child 2 in our program.
2. Child 3 has two fields X and Y. We need to update field Y using our program.

Problem :
1. How to get hold of Child 3?
2. How to update field Y in child 3?.

We need sample programs or explanation over phone/mail would help.
Back to top
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Mon May 19, 2008 6:52 pm
Reply with quote

I hope you have the key field value for the parent and the child-3 segment.

CALL 'CBLTDLI' USING WS-GHU
PCB-1
IO-AREA
SSA-PARENT
SSA-CHILD-3

WS-GHU PIC X(08) VALUE 'GHU '.
SSA-PARENT = PARENT(KEYFLD=XXXXX)
SSA-CHILD-3=CHILD3(KEYFLD=YYYYY)
IO-AREA = LAYOUT FOR SEGMENT - CHILD 3


MOVE 'UPDATE VALUE' TO Y(Chuild-3) Variable

CALL 'CBLTDLI' USING WS-REPL
PCB-1
IO-AREA

WS-REPL PIC X(08) VALUE 'REPL '.
Back to top
View user's profile Send private message
nitinmanipal

New User


Joined: 16 May 2008
Posts: 6
Location: bangalore

PostPosted: Mon May 19, 2008 8:29 pm
Reply with quote

kalukakkad wrote:
I hope you have the key field value for the parent and the child-3 segment.

CALL 'CBLTDLI' USING WS-GHU
PCB-1
IO-AREA
SSA-PARENT
SSA-CHILD-3

WS-GHU PIC X(08) VALUE 'GHU '.
SSA-PARENT = PARENT(KEYFLD=XXXXX)
SSA-CHILD-3=CHILD3(KEYFLD=YYYYY)
IO-AREA = LAYOUT FOR SEGMENT - CHILD 3


MOVE 'UPDATE VALUE' TO Y(Chuild-3) Variable

CALL 'CBLTDLI' USING WS-REPL
PCB-1
IO-AREA

WS-REPL PIC X(08) VALUE 'REPL '.


hi,
thanks i just want to know. when we access child 3 then is it neccessary that PARENT-SSA should be qualified.
Can both PARENT-SSA and CHILD-SSA be unqualified.

Thanks,
Nitin
Back to top
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Tue May 20, 2008 10:28 am
Reply with quote

Nitin,

yes, both of the SSA's can be unqualified, but then you have to make sure that the segment you are accessing is the correct one.

e.g.

CALL 'CBLTDLI' USING WS-GN
PCB-1
IO-AREA
SSA-PARENT
SSA-CHILD-3

WS-GHU PIC X(08) VALUE 'GN '.
SSA-PARENT = PARENT
SSA-CHILD-3=CHILD3
IO-AREA = LAYOUT FOR SEGMENT - CHILD 3

Now, you can issue the 'GN' call in a loop until status code 'GB' (end of DB) or 'GA'.
With each 'GA' it will move to next parent segment.
Back to top
View user's profile Send private message
nitinmanipal

New User


Joined: 16 May 2008
Posts: 6
Location: bangalore

PostPosted: Tue May 20, 2008 12:41 pm
Reply with quote

kalukakkad wrote:
Nitin,

yes, both of the SSA's can be unqualified, but then you have to make sure that the segment you are accessing is the correct one.

e.g.

CALL 'CBLTDLI' USING WS-GN
PCB-1
IO-AREA
SSA-PARENT
SSA-CHILD-3

WS-GHU PIC X(08) VALUE 'GN '.
SSA-PARENT = PARENT
SSA-CHILD-3=CHILD3
IO-AREA = LAYOUT FOR SEGMENT - CHILD 3

Now, you can issue the 'GN' call in a loop until status code 'GB' (end of DB) or 'GA'.
With each 'GA' it will move to next parent segment.


hi,

Thanks. in my case i am not concern about parent segment insrtances.
i just want to access child-3 instances.

so after establising parentage to PARENT(root) segment. can i use GNP call to access all the occerances of CHILD3.

Thanks,
Nitin
Back to top
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Tue May 20, 2008 2:07 pm
Reply with quote

yes, you can access all child3 segments under a parent that way.
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 May 20, 2008 4:31 pm
Reply with quote

The way that has always worked best for me is:

You have the parent by whatever means - qualified or unqualified SSA.

Now qualify the parent SSA - don't forget to load in the key for that segment. You need not set parentage!

Set up a loop to retrieve all child 3 segments until you get GB or GE.

You will GHN using the qualified SSA for the parent and and unqualifed SSA for the child 3 segment.

If you have a sucessful retrieval on your GHN, then issue your REPL. As with all database calls, check your status to make sure you were successful.
Back to top
View user's profile Send private message
nitinmanipal

New User


Joined: 16 May 2008
Posts: 6
Location: bangalore

PostPosted: Tue May 20, 2008 5:25 pm
Reply with quote

Sandy Zimmer wrote:
The way that has always worked best for me is:

You have the parent by whatever means - qualified or unqualified SSA.

Now qualify the parent SSA - don't forget to load in the key for that segment. You need not set parentage!

Set up a loop to retrieve all child 3 segments until you get GB or GE.

You will GHN using the qualified SSA for the parent and and unqualifed SSA for the child 3 segment.

If you have a sucessful retrieval on your GHN, then issue your REPL. As with all database calls, check your status to make sure you were successful.
Thanks all for ur comments
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 Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts S0C7 - Field getting overlayed COBOL Programming 2
No new posts Masking variable size field - min 10 ... DFSORT/ICETOOL 4
Search our Forums:

Back to Top