DATATYPE
───DATATYPE(string ─┬─────────┬─)──────
└──,type──┘
DATATYPE determines whether 'data' is numeric or alphabetic and returns
a result of NUM or CHAR. If only string is specified, the returned
result is NUM if string is a valid REXX number (any format); otherwise
CHAR will be the returned result.
If type is specified, the returned result is 1 if string matches
the type; otherwise, a 0 is returned. If string is null, 0 is returned
(except when type is X, which returns 1). The following is a list
of valid types. Only the capitalized letter is significant (all others are
ignored).
Alphanumeric
Returns 1 if string contains
only characters from the ranges a-z, A-Z, and 0-9.
Bits
Returns 1 if string contains only the
characters 0 and/or 1.
C
Returns
1 if string is a mixed SBCS/DBCS string.
Dbcs
Returns 1 if string is a pure DBCS string.
Lowercase
Returns
1 if string contains only characters from the range a-z.
Mixed
case
Returns 1 if string contains only
characters from the ranges a-z and A-Z.
Number
Returns 1 if string is a valid REXX number.
Symbol
Returns 1
if string contains only characters that are valid in REXX symbols.
Note that both uppercase and lowercase letters are permitted.
Uppercase
Returns 1 if string contains only characters
from the range A-Z.
Whole number
Returns
1 if string is a REXX whole number under the current setting of NUMERIC
DIGITS.
heXadecimal
Returns
1 if string contains only characters from the ranges a-f, A-F, 0-9,
and blank (so long as blanks only appear between pairs of hexadecimal characters).
Also returns 1 if string is a null string.
DATATYPE(' 12 ') -> 'NUM'DATATYPE('') -> 'CHAR'
DATATYPE('123*') -> 'CHAR'
DATATYPE('12.3','N') -> 1
DATATYPE('12.3','W') -> 0
DATATYPE('Fred','M') -> 1
DATATYPE('','M') -> 0
DATATYPE('Fred','L') -> 0
DATATYPE('?20K','S') -> 1
DATATYPE('BCd3','X') -> 1
DATATYPE('BC d3','X') -> 1
[Back: C2X (Character to Hexadecimal)]
[Next: DATE]