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
 
BETWEEN Clause for DATE columns

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

Active User


Joined: 03 Nov 2005
Posts: 269
Location: Mumbai

PostPosted: Tue May 14, 2013 6:00 pm    Post subject: BETWEEN Clause for DATE columns
Reply with quote

Hi All,

I am trying to Select data for 6 days from a DB2 Table in a Cobol program

WHERE clause I am providing is as below

Code:
WHERE DATE_COLUMN BETWEEN (:WS-INPUT-DATE - 6 DAYS) AND :WS-INPUT-DATE


But this is giving sql error code as -401

This query works fine in SPUFI

Here WS-INPUT-DATE coming from Input file

I tried like below as well
Code:
WHERE DATE_COLUMN BETWEEN DATE (DAYS(:WS-INPUT-DATE) - 6 DAYS) AND :WS-INPUT-DATE


But still no luck..

If I calculate WS-INPUT-DATE - 6 days outside sql query and provide it as Host variable it works fine.

I am just looking for if I am missing something and it's possible in Db2 query itself

Thanks in advance

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

chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 269
Location: Mumbai

PostPosted: Tue May 14, 2013 6:15 pm    Post subject:
Reply with quote

Hi Guys,

My bad I got the soulution for this

I changed it as below

Code:
WHERE DATE_COLUMN BETWEEN DATE (DAYS(:WS-INPUT-DATE) - 6 ) AND :WS-INPUT-DATE


I should have used 6 instead of 6 days

Regards,
Chandan
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue May 14, 2013 7:54 pm    Post subject:
Reply with quote

Good to hear it is working - thank you for posting the resolution icon_smile.gif

d
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