IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Cobol Code to Count the total no of orphan records


IBM Mainframe Forums -> IDMS/ADSO
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mahesh pillai

New User


Joined: 04 Oct 2011
Posts: 6
Location: india

PostPosted: Fri Oct 07, 2011 4:33 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Oct 07, 2011 4:41 pm
Reply with quote

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
View user's profile Send private message
mahesh pillai

New User


Joined: 04 Oct 2011
Posts: 6
Location: india

PostPosted: Fri Oct 07, 2011 4:45 pm
Reply with quote

am sorry.. am talking about IDMS database. In that we are having the child records for particular A record.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Oct 07, 2011 4:47 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri Oct 07, 2011 4:58 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Oct 07, 2011 7:22 pm
Reply with quote

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
View user's profile Send private message
robert_wood

New User


Joined: 04 Jan 2011
Posts: 8
Location: Portsmouth, UK

PostPosted: Fri Oct 07, 2011 7:24 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> IDMS/ADSO

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts To get the count of rows for every 1 ... DB2 3
No new posts run rexx code with jcl CLIST & REXX 15
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top