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

Date comparison - current date should be >= effective-dat


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ngilra

New User


Joined: 01 Oct 2005
Posts: 2

PostPosted: Sun Nov 06, 2005 6:03 am
Reply with quote

Hi Friends,

I have to compare current date with two dates which are defined in my DB2 table.
There are two dates with datanames, 'effective-date' and 'exp-date' in the Db2 table, I have to select record meeting some criteria and the condition for the current date should be >= effective-date and <= exp-date.
The format of effective-date and exp-date is mm-dd-yyyy.
I will appreciate if you help me in giving the suitable code.

Thanks in advance
Back to top
View user's profile Send private message
ikumar

New User


Joined: 02 Aug 2005
Posts: 81

PostPosted: Sun Nov 06, 2005 11:21 pm
Reply with quote

get the current date using,
EXEC SQL SET CURRENTDATE = :ws-currentdate END-EXEC.

in your sql, where clause is like,
WHERE :ws-currentdate BETWEEN EFFECTIVE-DATE and EXP-DATE

Hope this helps...

Thanks,
Kumar.
Back to top
View user's profile Send private message
ngilra

New User


Joined: 01 Oct 2005
Posts: 2

PostPosted: Sun Nov 06, 2005 11:51 pm
Reply with quote

Hi Kumar,

Thanks for the tip!
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts To get the the current time DFSORT/ICETOOL 13
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Changeman - how can we know the curr... Compuware & Other Tools 2
Search our Forums:

Back to Top