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
 
date logic

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
EnjoyMF

New User


Joined: 27 May 2005
Posts: 88

PostPosted: Wed Aug 31, 2005 4:06 pm    Post subject: date logic
Reply with quote

hi friends

i have a requirement where i need to find if the age is greater than 65years, if it is then i need to add one month to it...
how can this done though DB2 query..plz provide me the query if possible

Regards
prasad
Back to top
View user's profile Send private message

kvivek

New User


Joined: 09 May 2005
Posts: 51
Location: Singapore

PostPosted: Wed Aug 31, 2005 7:24 pm    Post subject:
Reply with quote

Quote:
if the age is greater than 65years
Code:
SELECT YEAR(CURRENT_DATE - DATE(:WS-DOB)) INTO :WS-NO-OF-YEARS FROM SYSIBM.SYSDUMMY1
Quote:
if it is then i need to add one month to it...
Code:
SELECT DATE(:WS-DOB) + 1 MONTH INTO :WS-DOB FROM SYSIBM.SYSDUMMY1


Regards,
Vivek
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Thu Nov 03, 2005 10:44 am    Post subject:
Reply with quote

hi frnd,
hope this query will give u that age det as my frnd given earlier
SELECT YEAR(CURRENT_DATE - DATE(:WS-DOB)) INTO :WS-NO-OF-YEARS FROM SYSIBM.SYSDUMMY1

then check IF WS-NO-OF-YEARS >=65 then
EXEC SQL
UPDATE SET that variable name=varname+1
END-EXEC
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 -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
No new posts Julian Date to CICS ABSTTIME blayek CICS 3 Wed Aug 30, 2017 11:15 pm
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm

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