Focal Point
[SOLVED] How to drop digits?

This topic can be found at:

October 05, 2018, 08:22 PM
Max Nevill
[SOLVED] How to drop digits?
Hi All.

I have some data in format P23.9. The user wants the last 7 digits dropped, with NO rounding.

P23.2, F7.2 and D23.2 round up.


This message has been edited. Last edited by: FP Mod Chuck,

WebFocus 8.104
Windows 7 Entreprise, SP1
October 07, 2018, 04:14 PM
Um, how about INT(Field * 100) / 100 ?


Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.05OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

October 08, 2018, 07:23 AM
Good old Cobol truncates by default so the challenge there is to remind people to specify 'rounded' to stop the truncation. How about subtracting .005 as you compute the new 2dp field - this way the rounding will look and feel like a truncation? So compute newfield/D23.2= oldfield - 0.005 ;

7.7.05 Windows.
October 11, 2018, 04:58 PM
Max Nevill
Great suggestions guys, I got it to work! I rarely deal with this kind of issue, so both suggestions weren't something I would have thought of on my own.


WebFocus 8.104
Windows 7 Entreprise, SP1