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

The use of LAST_DAY function


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

New User


Joined: 24 Feb 2008
Posts: 48
Location: Kolkata

PostPosted: Tue Mar 31, 2009 5:04 pm
Reply with quote

Hi,

I have a JCL from which I pass the date in the format DD.MM.YYYY to cobol. now i accept that in cobol and pass it to the LAST_DAY function whicle searching the last date of the month from SYSTDAT/SYSDUMMY1 table.

Query i wrote is like

Select LAST_DAY(WS-DATE)into..

It throws me error in bind. Says the token WS-DATE is invalid.

Please show me the way.

Thanks
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Tue Mar 31, 2009 10:35 pm
Reply with quote

change DD.MM.YYYY to DD-MM-YYYY and see
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Mar 31, 2009 11:10 pm
Reply with quote

Code:
Select LAST_DAY(WS-DATE)into..

should be

Select LAST_DAY(DATE(:WS-DATE))into..
Back to top
View user's profile Send private message
abhishek mitra

New User


Joined: 24 Feb 2008
Posts: 48
Location: Kolkata

PostPosted: Tue Mar 31, 2009 11:39 pm
Reply with quote

ashimer wrote:
change DD.MM.YYYY to DD-MM-YYYY and see


Hi,

Thanks for your reply.

But i believe both are equivalent with respect to a database.

Thanks
Abhishek
Back to top
View user's profile Send private message
abhishek mitra

New User


Joined: 24 Feb 2008
Posts: 48
Location: Kolkata

PostPosted: Tue Mar 31, 2009 11:43 pm
Reply with quote

Craq Giegerich wrote:
Code:
Select LAST_DAY(WS-DATE)into..

should be

Select LAST_DAY(DATE(:WS-DATE))into..


Thanks a lot for your reply.

I think this is going to work but as I am away from terminal so won't be able to tell whether it has actually resolved my problem or not.

Anyways just one more thing to ask.. If I use the same query for finding the last day of the previous month can i try like this -

Select LAST_DAY(DATE(:WS-DATE) - 1 month)into..

Regards
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 Calling an Open C library function in... CICS 1
No new posts DATE2 function SYNCSORT 15
No new posts Help on PL/I jsonPutValue function PL/I & Assembler 8
No new posts how to use Tso outtrap external function All Other Mainframe Topics 8
No new posts INSYNC option with same function as I... JCL & VSAM 0
Search our Forums:

Back to Top