VARTYPE()

VARTYPE()

Top  Previous  Next

 

The VARTYPE() function returns a value indicating the data type associated with a variable.

 

 

Format

 

VARTYPE(variable)

 

where

 

variableis the variable to be tested.

 

 

QM stores data internally in a type variant manner. The actual data type associated with a variable may change as new data is stored. The VARTYPE() function allows a program to determine the internal data type being used. It returns one of the following values. The symbolic names shown are defined in the SYSCOM KEYS.H include record.

 

0

VT$UNASSIGNED

Unassigned

2

VT$INTEGER

Integer value

3

VT$FLOATNUM

Floating point value

4

VT$SUBR

Subroutine reference

5

VT$STRING

String variable

6

VT$FILE.REF

File variable

7

VT$NULLVALUE

SQL style null value

8

VT$COLLECTION

Data collection

9

VT$IMAGE

Screen image from SAVE.SCREEN()

10

VT$ARRAY

Array in data collection

11

VT$SELLIST

Select list

13

VT$SOCK

Socket variable

15

VT$OBJ

Object instance of class module

18

VT$FILEWAIT

Monitor variable from FILE.EVENT()

 

 

Example

 

IF VARTYPE(FVAR) = VT$FILE.REF THEN

  CLOSE(FVAR)

END

 

This program fragment tests whether FVAR references an open file and, if so, closes the file. The same effect could have been achieved using the FL$OPEN mode of the FILEINFO() function.