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

Subtracting time in COBOL


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
manugeorge2004

New User


Joined: 17 Jun 2009
Posts: 38
Location: Denver

PostPosted: Fri Aug 26, 2011 9:52 pm
Reply with quote

Hi

I have a COBOL teradata program. The input file has a time field.
I need to execute a query on a teradata table using a BETWEEN clause within plus or minus 5 minutes. Teradata dont have the capability to have MINUTES in WHERE clause. I was thinking I can do this in COBOL code itself.

Do we have a COBOL function to add or subtract 5 minutes from a working storage variable which has time data. If not, do we have a teradata function to do this
Your help is appreciated
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri Aug 26, 2011 10:01 pm
Reply with quote

I recommend that you investigate the Language Environment functions CEELOCT (get local date and time) and CEESECS (convert timestamp to seconds).
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Aug 26, 2011 10:21 pm
Reply with quote

You must consider being on or close to a Midnight boundary, where the five minute difference to/from could be the next day, next month, next year or next century.

This is why Akatsukami's suggestion is germane.

Based upon a start date of January 1, 1900 at 00:0:00, Y2K date of 2000/01/01 at 00:00:00 equals 3155673600 milliseconds.

Mr. Bill
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Sat Aug 27, 2011 1:08 am
Reply with quote

Oops - a correction to my previous post. The millisecond value for 2000/01/01 - 00:00:00 is 3155673600000.

icon_redface.gif icon_redface.gif icon_redface.gif

Mr. Bill
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top