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
 
Can we get current date from any db2 table

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

New User


Joined: 19 Jan 2006
Posts: 17
Location: bangalore

PostPosted: Mon Jun 04, 2007 10:53 am    Post subject: Can we get current date from any db2 table
Reply with quote

hi,

can we get current date from any db2 table.

thanks
Back to top
View user's profile Send private message

mahi

New User


Joined: 04 Apr 2006
Posts: 86
Location: Pune

PostPosted: Mon Jun 04, 2007 12:07 pm    Post subject:
Reply with quote

yes we cam get it.. As per my knowledge from SYSIBM.SYSDUMMY1 we can get it....
Back to top
View user's profile Send private message
prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Mon Jun 04, 2007 4:33 pm    Post subject:
Reply with quote

'SELECT CURRENT DATE FROM SYSIBM.SYSDUMMY1 INTO :WS-CURRENT-DATE ' would get you the current date into the working storage variable WS-CURRENT-DATE
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Mon Jun 04, 2007 5:14 pm    Post subject:
Reply with quote

prasadvrk wrote:
'SELECT CURRENT DATE FROM SYSIBM.SYSDUMMY1 INTO :WS-CURRENT-DATE ' would get you the current date into the working storage variable WS-CURRENT-DATE

Code:
EXEC SQL
SET :WS-CURRENT-DATE = CURRENT DATE
END-EXEC.


Will also work.
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: Mon Jun 04, 2007 8:32 pm    Post subject:
Reply with quote

Hello,

I'm probably missing something here.

Is there some reason to interface with db2 to get a value already locally available from the system?

If you need to adjust the date, using db2 works nicly, but to just obtain the current date? Not sure i understand icon_confused.gif
Back to top
View user's profile Send private message
vardhan0007

New User


Joined: 05 Jun 2006
Posts: 51
Location: Bangalore,India

PostPosted: Wed Aug 08, 2007 3:24 pm    Post subject: How to format dates
Reply with quote

Hi,

I want to foramt date from 'yyyy-mm-dd' to either 'mmyydd' or 'ddmmyy'
or to julian date. CAn someone assist me onthis how to format the date.

Thanks in advance

Harsha.
Back to top
View user's profile Send private message
Prajesh_v_p

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Wed Aug 08, 2007 5:55 pm    Post subject:
Reply with quote

Basically current date refers to special register for getting the date....and hence it does not depend on the table.. the reason why we we are using sysdummy is that, it is having only one row always..

if you do select current date from a table having N rows..it will give N records with current date..

As dick said, you can get away with a db call just for current date..
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Wed Aug 08, 2007 6:02 pm    Post subject: Re: How to format dates
Reply with quote

vardhan0007 wrote:
Hi,

I want to foramt date from 'yyyy-mm-dd' to either 'mmyydd' or 'ddmmyy'
or to julian date. CAn someone assist me onthis how to format the date.

Thanks in advance

Harsha.


You ask the same question under another topic.
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 Adding a userid to SMTP Security table Yolanda Harvey JCL & VSAM 1 Sun Aug 13, 2017 6:16 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 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
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm


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