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
 
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 How syntax check at Bind time is diff... Poha Eater DB2 5 Wed Mar 21, 2018 9:16 pm
No new posts Merging records, but not all the time prino DFSORT/ICETOOL 17 Sat Feb 17, 2018 4:20 pm
No new posts Need to identify top 10 costly or tim... ashek15 DB2 4 Wed Feb 14, 2018 3:20 am
No new posts Logic to skip Maximum time-stamp and ... vickey_dw DB2 2 Thu Feb 01, 2018 11:15 pm
No new posts Using indexed variables in EZPLUS SRIDEVI TANTRY CA Products 1 Thu Feb 01, 2018 12:15 pm

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