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
 
Subtract 4 hours from TIME STAMP

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

New User


Joined: 25 Sep 2009
Posts: 13
Location: chennai

PostPosted: Fri Aug 05, 2011 3:03 pm    Post subject: Subtract 4 hours from TIME STAMP
Reply with quote

Hi,

I am retrieving TIME STAMP from DB2 Table in COBOL program. My requirement is I need to subtract exactly 4 hours from the retrieved value from DB2 Table. Is there any time routine to calculate this OR any other way to resolve this. Thanks in Advance.

Thanks,
Latheef
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Aug 05, 2011 3:10 pm    Post subject:
Reply with quote

depending on your version of DB2, look in the DB2 Reference and search for DATETIME arithmetic.
Back to top
View user's profile Send private message
yuvrajdutta

New User


Joined: 13 Jul 2009
Posts: 40
Location: India

PostPosted: Fri Aug 05, 2011 6:58 pm    Post subject: Reply to: Subtract 4 hours from TIME STAMP
Reply with quote

Rather than having COBOL do the DATE-TIME arithmetic why don't you let DB2 do the DATE-TIME arithmetic for you..

Code:

SELECT CURRENT TIMESTAMP AS TIME_NOW, CURRENT TIMESTAMP - 4 HOUR AS TIME_NOW_MINUS_4_HOURS FROM SYSIBM.SYSDUMMY1


Code:

TIME_NOW   TIME_NOW_MINUS_4_HOURS
2011-08-05 15:24:32   2011-08-05 11:24:32
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 Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
This topic is locked: you cannot edit posts or make replies. 00D3003B - time outs in DB2 when invo... chavinash2004 DB2 2 Mon Oct 09, 2017 4:39 pm
No new posts VSAM RLS Wait time blayek JCL & VSAM 2 Mon Oct 02, 2017 9:05 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Regarding time parameter shanthi gude JCL & VSAM 7 Mon Sep 04, 2017 2:31 pm

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