Datatype(N) as well as datatype(W) recognize a string like '0E00' as numeric. I fell into this trap on a mainframe with a DASD address like that. '0E00' is taken as a valid exponential notation for zero.
Datatype(W) also recognizes '1.000' as whole number.
If I want to test for figures only (like: 123), I use validate().
J.Peelen
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is there an easy test whether a value is numeric? (to avoid accepting a 'O' for '0',eg)
--Gary
Correction:
The function name should read verify() not validate().
Sorry
J.Peelen
Try
If you wish to test for a numeric value. If you're looking for an integer value, then
is what you're looking for. Either one will return "1" (true) if the value is valid, or "0" (false) if it doesn't pass.
Rick
Thanks Rick
--Gary
Note some pitfalls here:
Datatype(N) as well as datatype(W) recognize a string like '0E00' as numeric. I fell into this trap on a mainframe with a DASD address like that. '0E00' is taken as a valid exponential notation for zero.
Datatype(W) also recognizes '1.000' as whole number.
If I want to test for figures only (like: 123), I use validate().
J.Peelen