DATATYPE
If you specify type, returns 1 if string matches the type;
otherwise returns 0. If string is null, the function returns 0 (except when type is X, which returns 1 for a null string). The following are valid types. (Only the capitalized and highlighted letter
is needed; all characters following it are ignored. Note that for
the hexadecimal option, you must start your string
specifying the name of the option with x rather than h.)
- Alphanumeric
- returns 1 if string contains only characters from the ranges a–z, A–Z, and 0–9.
- Binary
- returns 1 if string contains only the characters 0 or 1 or both.
- C
- returns 1 if string is a mixed SBCS/DBCS string.
- Dbcs
- returns 1 if string is a DBCS-only string enclosed by SO and SI bytes.
- 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. (See Tokens.) Note that both uppercase and lowercase alphabetics 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 (as long as blanks appear only between pairs of hexadecimal characters). Also returns 1 if string is a null string, which is a valid hexadecimal 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
Note: The DATATYPE function tests the meaning or type of
characters in a string, independent of the encoding of those characters
(for example, ASCII or EBCDIC).
