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

Cobol Logic to find identical Bdates


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nirenchan

New User


Joined: 21 Jul 2005
Posts: 23
Location: USA

PostPosted: Tue Jan 13, 2009 12:04 am
Reply with quote

Hi,
Please help me in getting one cobol logic..

requirement:
here there are employee and family....... in my case..I'm employee and my spouse and kids are family..
requirement is to find out those kids having same Birth date. Birth date mm/dd/yy

If kids having same birth date then pass a parameter to 'Tbirth flag'

reading the records from Flat file... I just want the logic.

regards,
Nirenchan..
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: Tue Jan 13, 2009 12:26 am
Reply with quote

Your problem statement leaves a lot to be known:
One record per employee -- if so, what's the maximum number of kids?

Multiple records per employee (one per spouse, one per kid)? If so, how are the records distinguished? Is there an end of employee marker or just when the employee id changes? What kind of employee id is used?

Looking for exact matches on year, month, day? What about twins, triplets or higher -- how to handle them?

And, finally, what's wrong with an IF statement in COBOL?
Back to top
View user's profile Send private message
nirenchan

New User


Joined: 21 Jul 2005
Posts: 23
Location: USA

PostPosted: Tue Jan 13, 2009 1:15 am
Reply with quote

one record per employee,spouse and kids
we have ways to get number of kids.
match -kids date of birth...mm/dd/yy and if match is there just pass indicator to flag
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: Tue Jan 13, 2009 1:31 am
Reply with quote

Since it's one record -- just use an IF statement comparing the fields you want to compare. Easier if the record layout has an array to compare the birthdays, but not that hard otherwise; compare first to second, first to third, etc then second to third, second to fourth, etc until done.
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: Tue Jan 13, 2009 1:32 am
Reply with quote

Hello,

If you post some sample records for a few families with varying numbers of kids and show the "output" you want from each, it will help someone help you.

Are you trying to identify twins, triplets, etc or simply kids born on the same mm/dd?
Back to top
View user's profile Send private message
nirenchan

New User


Joined: 21 Jul 2005
Posts: 23
Location: USA

PostPosted: Tue Jan 13, 2009 2:04 am
Reply with quote

need to find kids born on same day....
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: Tue Jan 13, 2009 2:10 am
Reply with quote

Quote:
need to find kids born on same day....
Ok, now post the requested sample input for a few families and what you want fro mthat input.

Your request is completely clear to you, but not others. . .
Back to top
View user's profile Send private message
nirenchan

New User


Joined: 21 Jul 2005
Posts: 23
Location: USA

PostPosted: Tue Jan 13, 2009 2:17 am
Reply with quote

sample..

record having employee name dob, spouse, name dob, kids(1,-name dob 2-name dob,3-name dob..)

kids varing depends on family

need to find kids having same dob. ths is for existing records..want a new indicator.. then from that indication we cna identify this employee having kids with same dob
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: Tue Jan 13, 2009 2:38 am
Reply with quote

Hello,

One more time. . . . You need to show sample records for a few families - not a record layout.
Back to top
View user's profile Send private message
nirenchan

New User


Joined: 21 Jul 2005
Posts: 23
Location: USA

PostPosted: Tue Jan 13, 2009 3:03 am
Reply with quote

sorry..I dont have sample records...

I just want the logic how to get the dob match.


thanks
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Jan 13, 2009 3:18 am
Reply with quote

the logic depends on the record layout and dataset organization icon_smile.gif

there are two alternatives

variable length record with logical sections ( that could be there or not )
for example
Code:

single employee    ==> employee section
married            ==> employee section + wife section
married + children ==> employee section + wife section + child section 1 + child section 2 + ..... + child section n
widower + children ==> employee section + child section 1 + child section 2 + ..... + child section n


or one record for each family member
for example the layout could be
employee_code record_type additional data

each family group would contain as many records as there would be sections
with the same logic

for sequential dataset processing
to obtain the result would require a multipass approach

but until You are more specific on the requirement little we can do
Back to top
View user's profile Send private message
nirenchan

New User


Joined: 21 Jul 2005
Posts: 23
Location: USA

PostPosted: Tue Jan 13, 2009 3:27 am
Reply with quote

thanks enrico

The record some thinglike

its fixed :
employee# employee name spouse-name child1-name child2 ....

I'm sorry if I'm confusing you..

thanks guys...
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: Tue Jan 13, 2009 4:06 am
Reply with quote

Hello,

Quote:
sorry..I dont have sample records...
Invent some. It should not be difficult to make up some "fake" records that demonstrate the data you need to process.

You need to show the data content both so we can understand the input as well as offer suggestions as to how you can provide the "output" you want.

Until the input data format is resolved there and understood here, it is a complete waste of time to consider process details.
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: Tue Jan 13, 2009 5:51 pm
Reply with quote

Nirenchan: you say
Quote:
I just want the logic.
But without providing details about the implementation, the logic cannot be anything more than a very high-level overview. This overview has been provided to you for your use: compare kid one's birthday to kid two's, kid one's to kid three's, ... kid one's to kid n's; then compare kid two's to kid three's, ... kid two's to kid n's, and so forth.
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: Wed Jan 14, 2009 1:52 am
Reply with quote

Looks like it may have been too much effort to put into a homework assignment. . . icon_neutral.gif

d
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Jan 14, 2009 12:46 pm
Reply with quote

Hello,
Quote:
Looks like it may have been too much effort to put into a homework assignment
Agreed. Period.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 2
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top