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 

Precision Loss When Using SUM( )

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Thu Nov 06, 2008 4:08 pm    Post subject: Precision Loss When Using SUM( ) Reply with quote

I have the following query where Db2 is returning me INTEGER values against the 3rd summed up column .........even though the column APPLIED_AMT being summed is a DECIMAL (9.2).
Kindly let me know how to have SUM return the exact precision of DECIMAL (9.2) instead of it rounding up the sums to integer values.
Code:

SELECT X
      ,Y
      ,SUM ( CASE DBCR_CD  WHEN '30'                   
                           THEN  0.00 - APPLIED_AMT     
                           ELSE  APPLIED_AMT END)
      ,COUNT(*)
  FROM TABLE
 GROUP BY X, Y HAVING
  SUM ( CASE DBCR_CD WHEN '30'                   
                     THEN 0.00 - APPLIED_AMT     
                     ELSE APPLIED_AMT END) <> 0
Back to top
View user's profile Send private message
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Thu Nov 06, 2008 4:25 pm    Post subject: Reply with quote

OK...strange ...I just found this works as expected in QMF but when I use QMF for Windows its the other story.
Does anyone know how to setup QMF for Windows to overcome this precision loss in the results ?
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Nov 07, 2008 3:11 am    Post subject: Reply with quote

possibly by specifying a form. i don't know, but just a guess.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database 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