z/OS TSO/E REXX Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


DATATYPE

z/OS TSO/E REXX Reference
SA32-0972-00

Read syntax diagramSkip visual syntax diagram
>>-DATATYPE(string--+-------+--)-------------------------------><
                    '-,type-'      

returns 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.

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 az, AZ, and 09.
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 az.
Mixed case
returns 1 if string contains only characters from the ranges az and AZ.
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 AZ.
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 af, AF, 09, 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.
Here are some examples:
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

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).

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014