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
 

 

Convertion of big value in Float to decimal

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Silvia Mello

New User


Joined: 19 Jan 2009
Posts: 1
Location: Brazil

PostPosted: Thu Feb 19, 2009 6:14 pm    Post subject: Convertion of big value in Float to decimal
Reply with quote

Hi there,
Please, I need some help.
I'm using SPUFI and I'm trying to Select a column that is Float. I need to see the value in Decimal format. I'm not sure which scalar function I could use. I've tried DEC but I noticed that it's truncating the result:
---------+---------+---------+---------+---------+---------+
CREATE TABLE A151673.TESTE_FLOAT
(COL01 FLOAT(23));
---------+---------+---------+---------+---------+---------+
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0
---------+---------+---------+---------+---------+---------+
INSERT INTO A151673.TESTE_FLOAT
VALUES (1234567890123456789);
---------+---------+---------+---------+---------+---------+
DSNE615I NUMBER OF ROWS AFFECTED IS 1
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0
---------+---------+---------+---------+---------+---------+
SELECT DECIMAL(COL01, 19) , COL01
FROM A151673.TESTE_FLOAT;
---------+---------+---------+---------+---------+---------+
COL01
---------+---------+---------+---------+---------+---------+
1234567890123460000, +0,1234567890123457E+19
DSNE610I NUMBER OF ROWS DISPLAYED IS 1

Noticed that although the number I've inserted was 1234567890123456789, the number displayed was 1234567890123460000.
Does anyone know how to solve this problem?
Thanks in advance!
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Thu Feb 19, 2009 6:29 pm    Post subject: Reply to: Convertion of big value in Fload to decimal
Reply with quote

review the rules about floating point representation
... loss of significance/precision
( and different Floating point standards )
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Thu Feb 19, 2009 6:52 pm    Post subject:
Reply with quote

I think you can use CAST function.

Read more about CAST.
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 -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts DB2 FLOAT precision soundarr DB2 4 Fri Jul 15, 2016 9:47 pm
No new posts Convert Decimal to hexadecimal Steve Ironmonger DFSORT/ICETOOL 5 Fri May 27, 2016 4:19 pm
This topic is locked: you cannot edit posts or make replies. JCL to convert float decimal into rea... polymathtarun JCL & VSAM 3 Sun May 15, 2016 9:57 pm
No new posts conversion from char to packed decimal Musab Ahmed DFSORT/ICETOOL 7 Fri Apr 08, 2016 1:12 pm


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