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

Can we get current date from any db2 table


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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: Hyderabad

PostPosted: Mon Jun 04, 2007 12:07 pm
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
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
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

Moderator Emeritus


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

PostPosted: Mon Jun 04, 2007 8:32 pm
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
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
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
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 All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts count contained values of several col... DB2 5
No new posts Sorting date into YYYYMMDD, and creat... DFSORT/ICETOOL 13
No new posts To join 2 tables and to join 3rd tabl... DB2 8
No new posts Sort card to know that creation date ... DFSORT/ICETOOL 10
No new posts Create a specific record/file based o... SYNCSORT 8
Search our Forums:


Back to Top