We shall the check if a value is numeric using the option Datatype. Datatype is a reserved word in REXX.
/* REXX */
vari= " 1234"
result = Datatype( vari , N)
if result = 1 then say 'valid'
else say 'invalid'
exit
The value can contain trailing or leading spaces but not spaces in between.
For example:
dataype(" 1234",N) --> valid value
dataype("1234 ",N) --> valid value
dataype(" 1234 ",N) --> valid value
dataype("12 34",N) --> invalid value
/* REXX */
vari= " 1234"
result = Datatype( vari , N)
if result = 1 then say 'valid'
else say 'invalid'
exit
The value can contain trailing or leading spaces but not spaces in between.
For example:
dataype(" 1234",N) --> valid value
dataype("1234 ",N) --> valid value
dataype(" 1234 ",N) --> valid value
dataype("12 34",N) --> invalid value