View previous topic :: View next topic
|
Author |
Message |
Krishnadeva Reddy
New User
Joined: 14 Nov 2007 Posts: 37 Location: Chennai
|
|
|
|
Hi,
I have a table with values like
Total_Amount Paid_Amount
------------------------------------
0.01 0.00
89.50 0.01
When I am doing a unload using utility ADUUMAIN and select with the below statement:
SELECT CHAR(TOTALAMOUNT), CHAR(PAID_AMOUNT) FROM TABLE1 WITH UR;
I got the values as below in dataset:
000000.01 000000.00
000089.50 000000.01
I want the values into dataset same as in table.
0.01 0.00
89.50 0.01
Could any of you please help me out to acheive this. |
|
Back to top |
|
|
srikanthkailasam
New User
Joined: 13 Nov 2006 Posts: 24 Location: Bengalooru
|
|
|
|
Can you give the variable declarations of Total_Amount Paid_Amount? |
|
Back to top |
|
|
Krishnadeva Reddy
New User
Joined: 14 Nov 2007 Posts: 37 Location: Chennai
|
|
|
|
Both are of DECIMAL(9,2) datatype. |
|
Back to top |
|
|
srikanthkailasam
New User
Joined: 13 Nov 2006 Posts: 24 Location: Bengalooru
|
|
|
|
Where are you getting the values from??
Total_Amount Paid_Amount
------------------------------------
0.01 0.00
89.50 0.01
Is it from Spufi or QMF?? |
|
Back to top |
|
|
Krishnadeva Reddy
New User
Joined: 14 Nov 2007 Posts: 37 Location: Chennai
|
|
|
|
These are the actual values stored in Db2 table.
I want it to unload to a dataset and FTP to text file.
If I am not using CHAR conversion leading Zero's are removed when extracted to dataset.
If the value is 0.01 it comes as .01 in dataset ,So I used CHAR conversion. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Quote: |
These are the actual values stored in Db2 table.
|
NO!
Read the description of the char function in DB2 manuals!
DEC(9,2) are numeric data items and would be stored with leading zeros. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
These are the actual values stored in Db2 table. |
Why would you believe thie? |
|
Back to top |
|
|
Succor
New User
Joined: 20 Feb 2009 Posts: 96 Location: Bangalore :)
|
|
|
|
Quote: |
Hello,
Quote:
These are the actual values stored in Db2 table.
Why would you believe thie? |
Dick, it might be possible as when you do a select on a decimal field, it shows the value without leading zeroes. Even when i browse my table i don’t get to see the leading zeroes. |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
I think the point being made is that SPUFI, QMF, File-Aid for DB2, and any other software might suppress the leading zeros when being displayed, but the DB2 manual indicates that DECIMAL data types are stored in what COBOL refers to as packed decimal (COMP-3) which means leading zeros are present. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Keep in mind that when you "see" the values via some query, you are not seeing what is stored in the database, but rather a more "people friendly" presentation of the value.
Very much like in cobol when you move a packed-decimal field to an edited output field to get something like $12,345.88-. The currency sign, the comma, the decimal point, and the actual minus sign are not in the data field. They are inseerted for readability by the definition of the output field. |
|
Back to top |
|
|
Succor
New User
Joined: 20 Feb 2009 Posts: 96 Location: Bangalore :)
|
|
|
|
Quote: |
Keep in mind that when you "see" the values via some query, you are not seeing what is stored in the database, but rather a more "people friendly" presentation of the value.
|
That is true. Therefore i used
Quote: |
it might be possible as when you do a select on a decimal field, it shows the value without leading zeroes. Even when i browse my table i don’t get to see the leading zeroes. |
and as Terry indicated in SPUFI we get to see the results with suppressed zeroes.
I believe Krishnadeva is worried all about representation and not how the value is being actually stored. |
|
Back to top |
|
|
|