Tuesday, September 20, 2016

REXX: Checking for valid Numeric value

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

Featured Post

REXX Skeleton: Submitting jobs through Rexx

Submitting jobs through REXX and reading the spool through REXX gives us immense potential to automate many manual activities in mainframes....