360 pts.
 Numeric fields in AS/400
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

Answer Wiki:
One method - change field in DSPF to char - check the value in your program - fix or display error if spaces exist between the digits. phil Thanks Phil. I have used VALNUM in DSPF and resolved this issue.. Thanks again
Last Wiki Answer Submitted:  December 27, 2008  7:10 pm  by  philpl1jb   44,630 pts.
All Answer Wiki Contributors:  philpl1jb   44,630 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


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


 

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.

 3,115 pts.

 

%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

 44,630 pts.

 

VALNUM – Thanks, there’s always more to learn.
I’ve got atleast one place in my code that needs that code

Phil

 44,630 pts.