Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

IMS DB : Updating a field in Child Segment.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> IMS DB/DC
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    Post subject: IMS DB : Updating a field in Child Segment.
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    Post subject: Reply to: IMS DB : Updating a field in Child Segment.
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    Post subject: Re: Reply to: IMS DB : Updating a field in Child Segment.
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    Post subject: Reply to: IMS DB : Updating a field in Child Segment.
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    Post subject: Re: Reply to: IMS DB : Updating a field in Child Segment.
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    Post subject: Reply to: IMS DB : Updating a field in Child Segment.
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> IMS DB/DC All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Updating a VSAM file with DISP=OLD sheersh JCL & VSAM 8 Tue Mar 14, 2017 6:14 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts outrec field outside range Danielle.Filteau SYNCSORT 10 Sat Mar 04, 2017 2:37 am
No new posts 2 byte YEAR from Y'DATE2' field tecnokrat DFSORT/ICETOOL 2 Tue Feb 07, 2017 12:05 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us