Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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
This topic is locked: you cannot edit posts or make replies. Difference between EQUAL and EQUAL TO... jithinraghavan COBOL Programming 3 Thu Apr 19, 2018 2:22 am
This topic is locked: you cannot edit posts or make replies. UTC Timestamp Log Thangavel COBOL Programming 5 Mon Jan 22, 2018 9:04 pm
No new posts ISMF Difference between volume count ... upendrasri IBM Tools 2 Tue Dec 05, 2017 12:40 pm
No new posts How to query MAXGENS of an existing P... Chuchulo Hatyzak JCL & VSAM 4 Wed Nov 22, 2017 10:23 pm
No new posts Finding difference between two PS fil... Vignesh Sid SYNCSORT 5 Mon Oct 30, 2017 1:13 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us