View previous topic :: View next topic
|
Author |
Message |
Gaurav Chauhan
New User
Joined: 29 Oct 2007 Posts: 17 Location: Noida
|
|
|
|
I am using a SQL query in REXX to fetch data froma DB2 table. DB2 column has been defined as DECIMAL(12,2).
SQLQUERY = "SELECT COLUMNA AS REXXVAR ",
"FROM TABLEA ",
"WITH UR ; "
ADDRESS DB2 "SQL" SQLQUERY
Here COLUMNA has been defined as DECIMA(12,2) and REXXVAR is the variable where I am fetching this value.
But I am not getting data in correct format.
eg:- If COLUMNA has value 45.67, then it is being fetched as 4567 without decimal place.
Please assist.
Thanks. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Then you need to divide by 100 to get the required result. |
|
Back to top |
|
|
Gaurav Chauhan
New User
Joined: 29 Oct 2007 Posts: 17 Location: Noida
|
|
|
|
expat wrote: |
Then you need to divide by 100 to get the required result. |
But tool that I am generating would have random numbers. I can't hardcode by dividing by 100. Is there any REXX function to come to rescue ? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
As I understand this, the format of the data has been defined as DECIMA(12,2), which I take to mean that the field is 12 bytes long, with the last two bytes being the 2 decimal places.
I guess it's like the SAS format 12.2 or COBOL PIC 9(10)V99 where the decimal point is infered rather than physical.
The format is defined to one language / database but unknown to another, as DECIMA(12,2) is unknown to REXX. You need to adapt the second language / database to interpret the data format correctly.
Obviously if I have misunderstood your request, please feel free to clarify. |
|
Back to top |
|
|
Gaurav Chauhan
New User
Joined: 29 Oct 2007 Posts: 17 Location: Noida
|
|
|
|
expat wrote: |
The format is defined to one language / database but unknown to another, as DECIMA(12,2) is unknown to REXX. You need to adapt the second language / database to interpret the data format correctly.
|
you are right here. But that's what I need to know here. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
that' s what we are telling You,
for what reason are You concerned about the random ******
the table definition is the decision maker here
divide by 100 full stop
or by a power of ten congruent with the number of decimal places |
|
Back to top |
|
|
Gaurav Chauhan
New User
Joined: 29 Oct 2007 Posts: 17 Location: Noida
|
|
|
|
Did the trick.
Didn't get it initially. Thanks |
|
Back to top |
|
|
|