Yes, we all fight this one.
Natural sends the message due to an error condition, and he does not relinquish control (back to your program) until the error is resolved. So the ON ERROR and IF *ERROR-NR statements won't execute until the user fixes the problem - too late.
Change the input field from numeric to alpha. Then decide if you want to make things easy for yourself or for your user. I recommend the latter.
If the user knows that the input
must be entered in the format
number-decimal-number-number-number-number, then you can use the MASK clause.
DEFINE DATA LOCAL
1 #A (A6)
...
IF NOT #A = MASK (N'.'NNNN)
THEN
REINPUT 'Enter a value of format N1.4'
END-IF
But this doesn't allow flexibility for input values such as "1.1" or ".123", nor does it allow for negative values.
For flexibility, use the VAL function. But now you need to be concerned with too many decimal digits. That is, the user could enter ".12345" and VAL will truncate.
DEFINE DATA LOCAL
1 #A (A7) /* allow for negative
1 #T (N5.6) /* too many decimals
1 #N (N1.4)
END-DEFINE
REPEAT
INPUT ' Input:' #A (AD=M)
// 'Numeric:' #N (AD=O)
IF #A IS (N1.4)
THEN
IF #A <> ' '
THEN
#N := VAL (#A)
#T := VAL (#A) * 10000 /* too many decimals
IF FRAC (#T) <> 0 /* too many decimals
THEN
REINPUT FULL 'Too many decimal positions'
END-IF
ELSE
RESET #N
END-IF
ELSE
REINPUT 'Enter a value of format N1.4'
END-IF
END-REPEAT
END
Note that the input value is tested for non-blank, as older versions of Natural will abend when VAL is presented with a blank.