Focal Point
[SOLVED] How to drop digits?

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/1381057331/m/1877028096

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.

Thoughts?

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


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


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

October 08, 2018, 07:23 AM
Darryl_uk
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.

Thanks!


WebFocus 8.104
Windows 7 Entreprise, SP1