IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to retrieve DECIMAL value from a DB2 Table


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Mar 23, 2010 8:21 pm
Reply with quote

Dear Experts,

I have 2 Fields with datatype DECIMAL shown as below in my DB2 table.

COLNAME COLTYPE LENGTH SCALE
------- -------- ------ ------
QTY1 DECIMAL 15 3
QTY2 DECIMAL 15 2

Code:
Values in these columns looks like
------------------  ------------------
     -93058000.000        -99160692.50
       -100000.000          -106557.94
        -54000.000           -54183.33
      -4403000.000         -4691746.32
      -2489000.000         -2652227.25
        -50000.000           -54261.84


When I retrieve the columns as it as, they are displyed as NULL and junk values in my output report.

How to write a SELECT Query to retrieve the values as it is as shown above. i.e converting them into CHAR.

Please suggest ..
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Mar 23, 2010 9:02 pm
Reply with quote

When I retrieve the columns as it as, they are displyed as NULL and junk values in my output report.

How to write a SELECT Query to retrieve the values as it is as shown above. i.e converting them into CHAR.


What are you using to select the data for the report?

Maybe that "JUNK VALUES" is packed decimal values?
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Mar 23, 2010 11:09 pm
Reply with quote

Hi Crag,

I used the function CHAR(QTY1) and CHAR(QTY2). and got the outputs as expected. bu leading Zeroes.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Tue Mar 23, 2010 11:14 pm
Reply with quote

Hello,

Does this mean that all is well or is there still something that needs help?

Quote:
bu leading Zeroes.

icon_confused.gif
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts count contained values of several col... DB2 5
No new posts To join 2 tables and to join 3rd tabl... DB2 8
No new posts Create a specific record/file based o... SYNCSORT 8
No new posts Extract ISPF table column headings CLIST & REXX 2
No new posts Help required to reset decimal points... DFSORT/ICETOOL 10
Search our Forums:


Back to Top