View previous topic :: View next topic
|
Author |
Message |
niks_jude Warnings : 1 Active User
Joined: 01 Dec 2006 Posts: 144 Location: Mumbai
|
|
|
|
Hi,
I have a child ONE of root SER. I want to select through file-aid all roots having at least one occurence of the child ONE. Is that possible.
I am also writing program for the same, which one would be more efficient -
GN (with UNQUAL SSA for SER, UNQUAL SSA for ONE)
or
GN (with UNQUAL SSA for SER) in outer loop, followed in inner loop with GNP of UNQUAL SSA for ONE.
Thanks in advance. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
I'm not sure if I got your questions correctly, however using file-aid if you choose the option for Dynamic-PSB (0 Parameters/1 System Parameters/Dynamic or Static PSB ===> D) - then you've the liberty to de-select the segments you don't want to display in the end-result:
Code: |
File-AID for IMS ------------ System Parameters -----------------------------
COMMAND ===>
Installation data:
Release - 07.03.00
CPU ID - XXXXXX
Specify general options:
Language mode ===> C (C = COBOL; P = PL/I)
Data format ===> E (E = EBCDIC; M = MIXED; D = DBCS)
Dynamic or Static PSB ===> D (D = Dynamic; S = Static)
CAPS mode ===> ON (ON or OFF)
Codepage ===> 0697 ( ENGLISH ) |
Then select only the parent and child-segment-of-your-interest - from there, it's easy to see which parent does not have the child-segment-of-your-interest. |
|
Back to top |
|
|
niks_jude Warnings : 1 Active User
Joined: 01 Dec 2006 Posts: 144 Location: Mumbai
|
|
|
|
Thanks,Let me try as I do not have MF now. But I guess it might give me everything, one which do not have that child also. I want only those parents which have that particular child.
Any idea on the second one - I was thinking of writing two such programs and comparing the CPU. |
|
Back to top |
|
|
niks_jude Warnings : 1 Active User
Joined: 01 Dec 2006 Posts: 144 Location: Mumbai
|
|
|
|
I tried u meant exclude segment menu right? But it selected everything. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Well, it's tough to teach a tool using a Forum. Okay, I'll try if I get an idea to put some example to use it.
For what you asked for - idea is to "keep" all the parent-segments and the child-segment-of-interest and exclude all other segments. |
|
Back to top |
|
|
niks_jude Warnings : 1 Active User
Joined: 01 Dec 2006 Posts: 144 Location: Mumbai
|
|
|
|
Suppose I have 1000 roots in a database. Only 100 have child niks. I want to see only those 100 having child niks. Since child alone is not enough, I want to see both the 100 roots and 100 child's. |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
If you were writing this in COBOL, you would use an unqualified SSA - without a parent SSA - to read the specific child segment. You would then interogate the key feedback area for the key to the root. If you just need the keys, you've got them. If you actually need to retrieve the root segment, I would use multiple positioning. |
|
Back to top |
|
|
niks_jude Warnings : 1 Active User
Joined: 01 Dec 2006 Posts: 144 Location: Mumbai
|
|
|
|
Yes thanks I needed the key only.
Multi positioning - you mean GN call for both separately? Cannot we use path calls with unqual SSA for both - would not that fetch both in the same call. |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
You would lose your position on the child that you just got. I would maintain that position by setting up 2 PCBs for that database within your PSB - one for the GN on the child and the other for the GU with the key that you got from your key feedback area. I like the KISS method |
|
Back to top |
|
|
niks_jude Warnings : 1 Active User
Joined: 01 Dec 2006 Posts: 144 Location: Mumbai
|
|
|
|
I am not sure how would we lose position with a GN path call (of parent and child). |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
You aren't doing a path call. You are initially reading ONLY the child segment. You will then be positioned on that segment. Why would you want to do a path call? |
|
Back to top |
|
|
niks_jude Warnings : 1 Active User
Joined: 01 Dec 2006 Posts: 144 Location: Mumbai
|
|
|
|
So that I can read the root/child in one call. |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
That's not an efficient way to do it. You want to determine what root segments have a certain child - correct? It's much better programming to go after that child with an unqualified SSA - when you get a hit, then look at the key feedback area in the PCB to find the concatenated keys for all segments above. |
|
Back to top |
|
|
niks_jude Warnings : 1 Active User
Joined: 01 Dec 2006 Posts: 144 Location: Mumbai
|
|
|
|
Ok now I got the reason for not going for the path call..I though path call and GN call for the child would take up the same resources ..Thanks a ton !!!!! |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
Well.......it would not work. Remember that a parent child is a 1 to many relationship. You have 1 parent and maybe 2,000,000 children. How would you do it? |
|
Back to top |
|
|
niks_jude Warnings : 1 Active User
Joined: 01 Dec 2006 Posts: 144 Location: Mumbai
|
|
|
|
But for this child we have 1-to-1 relationship, parent has exactly one occurence of this child.
Code: |
DLI USING GN
PCB-PASK
IO_AREA
UNQUAL-SSA-PARENT (PARENT )
UNQUAL-SSA-CHILD (CHILD )
|
I was thinking of something like this, not getting time to try. I hope I have got your question. |
|
Back to top |
|
|
hchinnam
New User
Joined: 18 Oct 2006 Posts: 73
|
|
|
|
Here is a way to do it...
Declare a temp variable with low values and use that in your in SSA (get the segment that is greater than this variable).
Issue a GN call with root partly qualified(as said above) and child as un qualified.
Take the root key from KFB (If you need the data from root you can change the call to a path call).
Move the key you just got back in to your temp variable and loop. |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
If you had a 1 to 1 relationship, then there would be no logical reason for a parent-child relationship. That would be bad database design. |
|
Back to top |
|
|
niks_jude Warnings : 1 Active User
Joined: 01 Dec 2006 Posts: 144 Location: Mumbai
|
|
|
|
Hchinnan,
Thanks, looks better.
Sandy,
Some other team added the new segment....They are telling me this segment would be present only for some parents that is why they did so. |
|
Back to top |
|
|
|