Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
calculating age from DOB

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: calculating age from DOB
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    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Merging records and calculating TOTAL... venkata.ravi SYNCSORT 44 Mon Mar 25, 2013 12:34 pm
No new posts Calculating date difference using DFSORT Bharath RajaramSridharan DFSORT/ICETOOL 7 Mon Jan 21, 2013 2:19 pm
No new posts Freeware for calculating CPU Utilization arthy All Other Mainframe Topics 4 Fri Mar 25, 2011 3:43 pm
No new posts Calculating position of a string with... biswaranjan COBOL Programming 5 Wed May 26, 2010 8:51 am
No new posts Calculating dates of last year raj.tumu CLIST & REXX 3 Tue Dec 01, 2009 9:16 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us