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
 

 

Difference b/w timestamps

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

Active User


Joined: 22 May 2009
Posts: 158
Location: Bangalore

PostPosted: Mon Dec 20, 2010 3:04 pm    Post subject: Difference b/w timestamps
Reply with quote

Hi,
I;m trying to get the difference between two timestamp ,when running this query in SPUFI

Code:

   SELECT
    TIMESTAMP('2010-12-20-02.33.05.690798') -
    TIMESTAMP('2010-12-20-01.33.05.690798' ) 
      FROM SYSIBM.SYSDUMMY1;               


resulted in :10000.000000

But the same when tried to put in my code as
Code:

   EXEC SQL
       SET :A =  TIMESTAMP('2010-12-20-02.33.05.690798') -
                      TIMESTAMP('2010-12-20-01.33.05.690798' ) 
  END-EXEC.


   


is resulting in an error saying UNDEFINED OR UNUSABLE HOST VARIABLE A.

A is declared as PIC9(04)V9(06) COMP-3.

As this has to go in the table to a field of DECIMAL(10,6) i declared A in the above format.

Is the above correct??? please help me in this regards.[/quote]
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Dec 20, 2010 3:17 pm    Post subject:
Reply with quote

Why don't you check the manual?:

DB2 Vsn 8 SQL Reference wrote:
Subtracting timestamps: The result of subtracting one timestamp (TS2) from
another (TS1) is a timestamp duration that specifies the number of years, months,
days, hours, minutes, seconds, and microseconds between the two timestamps. The
data type of the result is DECIMAL(20,6).


further information can be obtained in the Application Programmers manual.
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Mon Dec 20, 2010 3:33 pm    Post subject:
Reply with quote

There is a section in the SQL V9 reference manual for duration calculations:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/DSNSQK10/2.22.5?DT=20070125023435
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 Sticky: difference between ... DUMMY ... and ... enrico-sorichetti JCL & VSAM 0 Mon Oct 17, 2016 4:31 pm
No new posts Difference space showed for TS and it... autobox DB2 1 Thu Apr 14, 2016 1:07 pm
No new posts Difference Between CICS WebSupport an... sachinji84 CICS 1 Mon Mar 07, 2016 7:25 pm
No new posts Difference between -180 and -181 with... deepak_shrivastava DB2 4 Wed Jan 06, 2016 10:00 am


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