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
 

 

The use of LAST_DAY function

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: The use of LAST_DAY function
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    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 What is the Extract Function in JCL dharmaraok JCL & VSAM 3 Wed Jun 14, 2017 9:12 am
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
No new posts Strange EXEC function call in z/VM Willy Jensen CLIST & REXX 3 Wed Oct 05, 2016 2:07 pm
No new posts Replace function abdulrafi COBOL Programming 13 Mon Sep 12, 2016 10:12 am


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