20 pts.
 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: November 15, 2009  2:47 PM
UPDATED: February 1, 2010  4:55 PM

Answer Wiki:
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 Wiki Answer Submitted:  November 17, 2009  6:42 pm  by  Meandyou   5,205 pts.
All Answer Wiki Contributors:  Meandyou   5,205 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

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).

 20 pts.