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
 

 

Timestamp difference in seconds - DB2 version 7

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

New User


Joined: 06 Jul 2006
Posts: 3
Location: Chennai, India

PostPosted: Thu Jul 06, 2006 3:38 pm    Post subject: Timestamp difference in seconds - DB2 version 7
Reply with quote

Hi,

I am trying to find out the difference between two timestamps in seconds.
Am not able to use TIMESTAMPDIFF as that works in version 8.
Could anyone suggest an alternative that would work in version 7?

Thanks in advance.
Back to top
View user's profile Send private message

Hanfur

Active User


Joined: 21 Jun 2006
Posts: 104

PostPosted: Fri Jul 07, 2006 10:13 am    Post subject: Hi
Reply with quote

If u use any host language you could capture time using the TIME_STAMP data type like this in seconds.

SELECT INT(HOUR(CURRENT_TIMESTAMP) * 3600) +
INT(MINUTE(CURRENT_TIMESTAMP) * 60) +
INT(SECOND(CURRENT_TIMESTAMP))
INTO :WS-START-SECONDS
FROM SYSIBM.SYSDUMMY1

This is used in host language u may need to tweak this to get the differnec in time stamp value from table.

-Han.
Back to top
View user's profile Send private message
mrajagop

New User


Joined: 06 Jul 2006
Posts: 3
Location: Chennai, India

PostPosted: Fri Jul 07, 2006 10:45 am    Post subject: Re: Hi
Reply with quote

Thank you, Hanfur.

In this case, the date part of the timestamp also needs to be converted to seconds. Of course we could use functions like YEAR(), MONTH() and DAY() to find that out.

If there is some other way out, could you please let me know?

Thanks again.
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 Difference between TWALENG and TWASIZE Arunkumar Chandrasekaran CICS 3 Tue Jan 03, 2017 12:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Sticky: difference between ... DUMMY ... and ... enrico-sorichetti JCL & VSAM 0 Mon Oct 17, 2016 4:31 pm
No new posts Is there a time Version of DATEDIFF ? Bill Woodger DFSORT/ICETOOL 1 Wed Aug 17, 2016 7:06 pm
No new posts Syncsort version supporting FINDREP c... juares castro SYNCSORT 9 Tue Aug 09, 2016 6:54 pm


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