>>-DATATYPE(string--+-------+--)------------------------------->< +-,type-+
NUM
if you specify only string and if string is a valid Rexx number that can be added to 0 without error; returns CHAR
if string is not a valid number.
1
if string matches the type. Otherwise, it returns 0
. If string is null, the function returns 0
(except when the type is X
or B
, for which DATATYPE returns 1
for a null string). The following are valid types. (Only the capitalized letter, or the number of the last type listed, is needed; all characters surrounding 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
.)
1
if string contains only characters from the ranges a
-z
, A
-Z
, and 0
-9
.
1
if string contains only the characters 0
or 1
, or whitespace. Whitespace characters can appear only between groups of 4 binary characters. It also returns 1
if string is a null string, which is a valid binary string.
1
if string contains only characters from the range a
-z
.
1
if string contains only characters from the ranges a
-z
and A
-Z
.
1
if DATATYPE(string)
returns NUM
.
1
if the string is exactly "0" or "1". Otherwise it returns 0
.
1
if string is a valid symbol, that is, if SYMBOL(string)
does not return BAD
. (See Section 1.10.4.4, “Symbols”.) Note that both uppercase and lowercase alphabetics are permitted.
1
if string contains only characters from the range A
-Z
.
1
if string could appear on the left-hand side of an assignment without causing a SYNTAX condition.
1
if string is a Rexx whole number under the current setting of NUMERIC DIGITS.
1
if string contains only characters from the ranges a
-f
, A
-F
, 0
-9
, and whitespace (as long as the whitespace characters appear only between pairs of hexadecimal characters). It also returns 1
if string is a null string, which is a valid hexadecimal string.
1
if DATATYPE(string,"W")
returns 1
when NUMERIC DIGITS is set to 9
.
Example 7.30. Builtin function DATATYPE
DATATYPE(" 12 ") -> "NUM" DATATYPE("") -> "CHAR" DATATYPE("123*") -> "CHAR" DATATYPE("12.3","N") -> 1 DATATYPE("12.3","W") -> 0 DATATYPE("Fred","M") -> 1 DATATYPE("Fred","U") -> 0 DATATYPE("Fred","L") -> 0 DATATYPE("?20K","s") -> 1 DATATYPE("BCd3","X") -> 1 DATATYPE("BC d3","X") -> 1 DATATYPE("1","O") -> 1 DATATYPE("11,"O") -> 0
Note