20 pts.
Q:
DECFLOAT - Internal Format
Hello,

How to translate an internal DECFLOAT value into a visual format? DB2 Administration Guide: "Convert and return a DECFLOAT representation of a number or string representation of a number", (Appendix A. Writing exit routines).

There is an example there:

Internal Format              DFP Format                String Representation

D8F77D00000000000C    222C000000001E80     +7.500  

 

They do not explain, how to convert. Can anybody help, please? Thanks

 



Software/Hardware used:
Assembler
ASKED: Nov 15 2009  2:47 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2645 pts.
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • Bookmark and Share
Hello,

I am not sure what you mean by "visual format."

I will take a guess that you want a floating point number to be returned to your application as a decimal number. Use the DECIMAL function.

For example:

CREATE TABLE TTEST (F_COL FLOAT);
---------+---------+---------+---------+---------+---------+-----
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

INSERT INTO TTEST VALUES (7.500);
---------+---------+---------+---------+---------+---------+-----
DSNE615I NUMBER OF ROWS AFFECTED IS 1
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0
SELECT F_COL , DEC(F_COL,5,3)
FROM TTEST;
---------+---------+---------+---------+---------+---------+-----
F_COL
---------+---------+---------+---------+---------+---------+-----
+0.7500000000000000E+01 7.500
DSNE610I NUMBER OF ROWS DISPLAYED IS 1
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100

DROP TABLE TTEST;
Last Answered: Nov 17 2009  6:42 PM GMT by Meandyou   2645 pts.
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Eligin   20 pts.  |   Feb 1 2010  4:55PM GMT

Hello Meandyou,
I have to transfer a DB2 decimal floating point value (in Sortable Decimal Format) to a character string, for example,
X’D8F77D00000000000C’ to C’7.5′ (or to a regular DFP number, X’222C000000001E80′ ) in an Assembler program (z/OS).