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
 

 

Cobol Code to Count the total no of orphan records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> IDMS/ADSO
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    Post subject: Cobol Code to Count the total no of orphan records
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: 7932
Location: Bellevue, IA

PostPosted: Fri Oct 07, 2011 4:41 pm    Post subject:
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    Post subject: Reply to: Cobol Code to Count the total no of orphan records
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    Post subject:
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: 1722
Location: UK

PostPosted: Fri Oct 07, 2011 4:58 pm    Post subject:
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

Site Director


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

PostPosted: Fri Oct 07, 2011 7:22 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> IDMS/ADSO All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Full Time COBOL Software Development ... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:24 am
This topic is locked: you cannot edit posts or make replies. COBOL Software Development Lead at Fi... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:21 am
No new posts How to Capture the Max return code of... anilkumar922 All Other Mainframe Topics 0 Thu Jan 12, 2017 12:02 pm
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm


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