View previous topic :: View next topic
|
Author |
Message |
nitinmanipal
New User
Joined: 16 May 2008 Posts: 6 Location: bangalore
|
|
|
|
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 |
|
|
kalukakkad
New User
Joined: 10 Mar 2005 Posts: 81
|
|
|
|
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 |
|
|
nitinmanipal
New User
Joined: 16 May 2008 Posts: 6 Location: bangalore
|
|
|
|
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 |
|
|
kalukakkad
New User
Joined: 10 Mar 2005 Posts: 81
|
|
|
|
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 |
|
|
nitinmanipal
New User
Joined: 16 May 2008 Posts: 6 Location: bangalore
|
|
|
|
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 |
|
|
kalukakkad
New User
Joined: 10 Mar 2005 Posts: 81
|
|
|
|
yes, you can access all child3 segments under a parent that way. |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
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 |
|
|
nitinmanipal
New User
Joined: 16 May 2008 Posts: 6 Location: bangalore
|
|
|
|
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 |
|
|
|