Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

comparing year part of hostvariable date

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

New User


Joined: 10 May 2009
Posts: 72
Location: bangalore

PostPosted: Wed Jun 10, 2009 6:15 pm    Post subject: comparing year part of hostvariable date
Reply with quote

hi
i have a req as follows:

i use query for selecting date from table
but one of the filering criteria is year part of the date(from table) = input year

how can i write this is query..? i am using a cursor to fetch rows.

pls suggest
Back to top
View user's profile Send private message

Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Wed Jun 10, 2009 6:18 pm    Post subject: Reply to: comparing year part of hostvariable date
Reply with quote

Shouldn't this be in the DB2 forum because SQL queries can be written for several languages?
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1226
Location: Israel

PostPosted: Wed Jun 10, 2009 6:35 pm    Post subject:
Reply with quote

It should be easy:

Code:
SELECT * FROM my.table WHERE YEAR(my_date_field) = YEAR(CURRENT DATE)
Back to top
View user's profile Send private message
sm_2009

New User


Joined: 10 May 2009
Posts: 72
Location: bangalore

PostPosted: Wed Jun 10, 2009 6:39 pm    Post subject:
Reply with quote

will it work if Current date is a ws field
means YEAR(WS-INPUT-DATE)


ws-input-date is in db2 format
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1226
Location: Israel

PostPosted: Thu Jun 11, 2009 3:11 am    Post subject:
Reply with quote

I hoped YOU would tell me.
So please try and tell me (and don't forget the":" thingy).
Back to top
View user's profile Send private message
sm_2009

New User


Joined: 10 May 2009
Posts: 72
Location: bangalore

PostPosted: Thu Jun 11, 2009 11:16 am    Post subject:
Reply with quote

hey yesss its working
thanks
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 Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm
No new posts Overlay the system date Danielle.Filteau SYNCSORT 4 Fri Mar 03, 2017 1:16 am
No new posts Checking Current date vickey_dw DFSORT/ICETOOL 1 Wed Feb 08, 2017 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us