View previous topic :: View next topic
|
Author |
Message |
nirenchan
New User
Joined: 21 Jul 2005 Posts: 23 Location: USA
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
nirenchan
New User
Joined: 21 Jul 2005 Posts: 23 Location: USA
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
nirenchan
New User
Joined: 21 Jul 2005 Posts: 23 Location: USA
|
|
|
|
need to find kids born on same day.... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
nirenchan
New User
Joined: 21 Jul 2005 Posts: 23 Location: USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
One more time. . . . You need to show sample records for a few families - not a record layout. |
|
Back to top |
|
|
nirenchan
New User
Joined: 21 Jul 2005 Posts: 23 Location: USA
|
|
|
|
sorry..I dont have sample records...
I just want the logic how to get the dob match.
thanks |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
the logic depends on the record layout and dataset organization
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 |
|
|
nirenchan
New User
Joined: 21 Jul 2005 Posts: 23 Location: USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Looks like it may have been too much effort to put into a homework assignment. . .
d |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Hello,
Quote: |
Looks like it may have been too much effort to put into a homework assignment |
Agreed. Period. |
|
Back to top |
|
|
|