Right idea, but not quite there in implementation.
ALL values in the Dialogue Manager are stored as character strings. This is fine for alphanumerics and whole numbers, but HOW MANY decimal point digits should be stored?
So, what happens is, when a calculation is done, the strings involved are converted to double precision, the calculation done, and then the result converted back to INTEGER (since we don't know how many decimal digits to keep), and then converted to alpha. What you can do is 'catch' the result BEFORE it gets converted to integer, and convert it yourself, providing information on the number of decimal digits desired. You do this (as stated), by using the FTOA routine, BUT, you must do the calculation WITHIN the subroutine, to KEEP the decimal digits. So, it looks like this:
Code:
-SET &RE = FTOA(15.25 - 7.39 , '(D15.2c)', 'A15');
What's different is:
1. the calculation is done within the subroutine itself
2. the output format (which specifies number of decimal digits) has the 'c' edit option, which suppresses the commas you NORMALLY get with 'D' format output.
3. The last argument is enclosed in single quotes. The length should be the same (or more) than that given in the format.
The result will have leading blanks, which, if not desired, can be removed by using the LJUST routine and the TRUNCATE function, like this:
Code:
-SET &RE = LJUST(15,&RE,'A15');
-SET &RE = TRUNCATE(&RE);