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 INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am


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