MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

COBOL Data definition for DB2 TIMESTAMP arithemtic

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
shootingstar
Beginner


Joined: 19 Sep 2004
Posts: 14
Topics: 11
Location: Dallas, TX

PostPosted: Wed Nov 10, 2004 10:48 pm    Post subject: COBOL Data definition for DB2 TIMESTAMP arithemtic Reply with quote

I am trying to calculate a time duration in a DB2 program by subtracting a starting timestamp from the ending timestamp. The result, according to the DB2 manual is DECIMAL 20.6 which translates to cobol as S9(14)V9(6) COMP-3.
Unfortunately this results in a computational field of more than 18 digits, which is apparently beyond the COBOL language spec for computational fields. Is there any way around this, or do I have to do it in assembler?

Any suggestions would be greatly appreciated.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Thu Nov 11, 2004 5:33 am    Post subject: Reply with quote

Quote:

Unfortunately this results in a computational field of more than 18 digits, which is apparently beyond the COBOL language spec for computational fields. Is there any way around this, or do I have to do it in assembler?


Not exactly true. With the new Enterprise COBOL for z/OS and OS/390 V3R2 you can code up to 31 digits in the picture clause. But you will need the compiler option ARITH(EXTEND) to perform arthimetic operations on long integers

http://www.mvsforums.com/helpboards/viewtopic.php?t=1855&highlight=extend

Also check this link which discusses about getting the difference between 2 timestamps in seconds.

http://www.mvsforums.com/helpboards/viewtopic.php?t=2261

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group