I have a numeric field 5,2 in a display file. when i am entering values i have blanks in between two numeric digits. the program is considering these blanks as zero. I hvae to avoid this, please let me know the way.
Software/Hardware used:
ASKED:
December 22, 2008 12:26 PM
UPDATED:
December 29, 2008 1:41 PM
As suggested, redefine the field as char. In the RPG pgm, you can use %dec function.
numField = %dec(charField:5:2)
The %dec ignores any blanks and aligns the decimal point automagically.
%Dec will create a number as 1—5.00 becomes 15.00 (— are blanks)
However, this is a hanging chad type problem, did the user intend to enter 1.00 or 15.00?
So what I do is inspect the entry and if it looks bad redisplay it as an error and make the
user fix it, after all they are still sitting there and should know what they intended.
Phil
VALNUM – Thanks, there’s always more to learn.
I’ve got atleast one place in my code that needs that code
Phil