NET/MASTER Network Control Language (NCL) Reference Manual

DATATYPE
Built-in Functions
4–34 106126 Tandem Computers Incorporated
DATATYPE The DATATYPE built-in function tests a string for a specified data type. Depending
on the type that you specify, the result can be a true value of 1 or a false value of 0
(zero). If you do not specify a type, and the string is wholly numeric, the value NUM
is returned. Otherwise the value CHAR is returned.
DATATYPE(
string
[,
type
] )
string
specifies the string to be tested. The inclusion of any arithmetic or logical
operators in the string can cause unexpected results unless the string is enclosed in
quotes or expressed as a variable. See the second example following.
type
specifies the data type that the string is tested for. Only the first uppercased letter
is significant. The value 1 is returned if the string contains only the characters
specified; otherwise, 0 (zero) is returned.
If
type
is specified, it must be one of the following search values or an error
message is issued. If
type
is not specified, the string is tested to determine if it is a
valid number.
Possible search values for
type
are:
A (alphanumeric)
string
contains only the characters a through z, A through Z, and 0 through
9.
B (bits)
string
contains only the characters 0 and 1. Spaces are permitted and are
used to indicate byte boundaries.
H or X (hexadecimal)
string
contains only hexadecimal characters (a-f, A-F, 0-9). Spaces are
permitted at byte boundaries.
L (lowercase)
string
contains only the characters a through z.
M (mixed case)
string
contains only the characters A through Z or a through z.
N (number)
string
is a valid number.