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

calculating age from DOB


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vijayakumar_vc

New User


Joined: 14 Mar 2005
Posts: 2

PostPosted: Sat Apr 16, 2005 10:29 am
Reply with quote

hello friends

please give cobol coding tips for calculating age from
the given date of birth.
Back to top
View user's profile Send private message
ankyhunk

Moderator


Joined: 05 May 2005
Posts: 98
Location: Navi Mumbai, India

PostPosted: Thu May 05, 2005 6:29 pm
Reply with quote

You can accept the date of birth from user into a variable using ACCEPT keyword in YYYYMMDD format. Then you can obtain system date using CURRENT-DATE function & move the value to a variable of PIC 9(08). The difference will give you the age in years, months & days.
Back to top
View user's profile Send private message
ashutosh719

New User


Joined: 06 Apr 2005
Posts: 12

PostPosted: Sat May 07, 2005 2:40 pm
Reply with quote

OR use Cobol's Intrinsic functions directly...Integer-of-day etc...
Back to top
View user's profile Send private message
kvivek

New User


Joined: 09 May 2005
Posts: 51
Location: Singapore

PostPosted: Tue May 10, 2005 7:43 pm
Reply with quote

Hi Vijay,

You could use the following SQL

SELECT CURRENT_DATE - WS-DOB FROM SYSIBM.SYSDUMMY1

which returns the exact number of years, months and days. It also take care of Leap year and the difference in number of days of each month.

Regards,
Vivek
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 -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Merging records and calculating TOTAL... SYNCSORT 44
No new posts Calculating date difference using DFSORT DFSORT/ICETOOL 7
No new posts Freeware for calculating CPU Utilization All Other Mainframe Topics 4
No new posts Calculating position of a string with... COBOL Programming 5
No new posts Calculating dates of last year CLIST & REXX 3
Search our Forums:

Back to Top