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
 

 

Arithmetic between Variables containing Time

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Sivagurunathan Jagadeesan

New User


Joined: 06 Mar 2007
Posts: 32
Location: India

PostPosted: Wed Mar 07, 2007 7:50 am    Post subject: Arithmetic between Variables containing Time
Reply with quote

I am working on Enterprise COBOL. I would like to know if there is any COBOL Function which I can add/subtract variables that hold Time (HH:MM:SS) of the day.

Siva
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Mar 07, 2007 9:05 am    Post subject:
Reply with quote

Hello,

I'm not aware of "time arithmetic" in COBOL directly.

Check out this from another source:
Quote:
DB2 provides the capability to add and subtract DATE, TIME, and TIMESTAMP columns. Keep in mind the following rules:

-both operands must be of the same data type (ie, both dates or both times)
Example: CURRENT DATE - 1 MONTH or CURRENT DATE + 1 DAY

-if one operand is a timestamp, the other operand can be a time or a date, but not a timestamp.
Example: TIMESTAMP + 1 DAY or TIMESTAMP - 24 HOURS

-date durations are expressed as DECIMAL(8,0). The valid date durations are:
DAY, MONTH, and YEAR and their plural equivalents.

-time durations are expressed as DECIMAL(6,0). The valid time durations are:
HOUR, MINUTE, SECOND, and MICROSECOND and their plural equivalents.



Several places i've been, there was a callable routine that provided time addition and subtraction. You might write your own if DB2 will not meet your requirement.
Back to top
View user's profile Send private message
Sivagurunathan Jagadeesan

New User


Joined: 06 Mar 2007
Posts: 32
Location: India

PostPosted: Wed Mar 07, 2007 2:48 pm    Post subject: Arithmetic between Variables containing Time
Reply with quote

Hi,

Thanks a lot, DB2 would best suit me, when there is no Intrinsic function in COBOL.

Thanks,
Siva
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Mar 07, 2007 10:35 pm    Post subject:
Reply with quote

You're welcome icon_smile.gif
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 8 Wed Jan 25, 2017 8:24 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:23 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:21 pm


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