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


Determining the data type of an expression - &DATATYPE

z/OS TSO/E CLISTs
SA32-0978-00

Use the &DATATYPE built-in function to determine what type of data an evaluated expression contains. After evaluating the expression, a CLIST replaces this built-in function with one of the following strings: CHAR, NUM, DBCS, or MIXED. The strings indicate the following:
  • CHAR -- The evaluated expression contains at least one non-numeric EBCDIC character and no double-byte character set (DBCS) characters.
  • NUM -- The evaluated expression is entirely numeric.
  • DBCS -- The evaluated expression is a single delimited string of DBCS data.
  • MIXED -- The evaluated expression contains both DBCS and EBCDIC data.
The following examples show the evaluations of various expressions:
SET A = &DATATYPE(ALPHABET)            /* result: &A = CHAR
SET B = &DATATYPE(1234)                /* result: &B = NUM
SET C = &DATATYPE(SYS1;PROCLIB)        /* result: &C = CHAR
SET D = &DATATYPE(3*2/4)               /* result: &D = NUM
SET E = &DATATYPE(12.34)               /* result: &E = CHAR
For example, the following clause evaluates as true:
IF &DATATYPE(12.34)=CHAR THEN
The following examples use the convention d1d2 to represent two DBCS characters and < and > to represent the shift-out and shift-in delimiters (X'0E' and X'0F') that mark the beginning and end of the DBCS string.
SET A = &DATATYPE(<d1d2>)              /* result: &A = DBCS
SET B = &DATATYPE(ABC<d1d2>123)        /* result: &B = MIXED
SET C = &DATATYPE(<>)                  /* result: &C = DBCS
SET D = &DATATYPE(A<>C)                /* result: &D = MIXED
SET E = &DATATYPE(<d1d2><d3d4>)        /* result: &E = MIXED
For example, the following clauses evaluate as true:
IF &DATATYPE(<d1d2d3>)=DBCS THEN
IF &DATATYPE(A<d1d2d3>B)=MIXED THEN

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014