View previous topic :: View next topic |
Author |
Message |
shootingstar Beginner
Joined: 19 Sep 2004 Posts: 14 Topics: 11 Location: Dallas, TX
|
Posted: Wed Nov 10, 2004 10:48 pm Post subject: COBOL Data definition for DB2 TIMESTAMP arithemtic |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Thu Nov 11, 2004 5:33 am Post subject: |
|
|
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 |
|
|
|
|