View previous topic :: View next topic
|
Author |
Message |
mahesh pillai
New User
Joined: 04 Oct 2011 Posts: 6 Location: india
|
|
|
|
I need to write a COBOL code. where i need to find out the total count of the records which do not have relation to the child.
for ex:- If there are 4 records A,B.C and D. where A is linked with B as
A-B, A is linked with C as A-C and A is linked with D as A-D. where B,C and D are child record of the A. I need to write a query where it counts the number of records available in A where it is not related with any of the child records B or C or D.
Can anyone help me out?? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
I doubt you're going to get a lot of help based on what you've posted. You seem to be talking about a database -- IMS, perhaps? -- but did not make that clear. Records in files do not have parent / child relationships.
Why not write the code to go through all the A records, and set a flag for each unique value, if you find a child record then turn off the flag. If you hit the end of the unique value records and the flag is still set, you found one without a child. |
|
Back to top |
|
|
mahesh pillai
New User
Joined: 04 Oct 2011 Posts: 6 Location: india
|
|
|
|
am sorry.. am talking about IDMS database. In that we are having the child records for particular A record. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Quote: |
If there are 4 records A,B.C and D. where A is linked with B as
|
When you say records.. do you mean you have file as input? |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
obtain first in set p
check for child set(s)
if none exists increment counter
obtain next within p
Now, it is 15 years since I did IDMS but I think that should give you a clue as to how to proceed. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello and welcome to the forum,
You will get more useful replies if you post your questions in the appropriate part(s) of the forum . . .
This has been moved to the IDMS part of the forum. |
|
Back to top |
|
|
robert_wood
New User
Joined: 04 Jan 2011 Posts: 8 Location: Portsmouth, UK
|
|
|
|
IF SET EMPTY condition.
Or OLQ (if you have it) for an online quick and dirty.
However... if you do not know how to do this, I would suggest that you should not be let loose on an IDMS database. |
|
Back to top |
|
|
|