TYPE

Contents


type is used to find the type of a variable.

 

Syntax

   type( nom_var )

 

Parameters

Element

Description

Restrictions

nom_var

Name of a variable in the form: [ class ] nom_de_variable

   None.

 

Examples

   # Test of existence of a variable
   If type ([M:TOTO]VAR1) < 0
       Errbox "Non-existent variable!"
   Endif

   # Reset a variable to zero
   Case type (VARIA)
       When 1, 2, 4, 5, 6, 7, 9
           VARIA = 0
       When 3
           VARIA = [0/0/0]
       When Default
           VARIA = ""
   Endcase

 

Description and comments

type returns a code for the type of variable given in the parameters. This code has the following values:

Code returned

Corresponding type

Associated declaration

-1

Non-existent variable.

1

Text .

Text

2

Short integer

Shortint

3

Date.

Date

4

Long integer

Integer

5

Floating point number

Float (obsolete)

6

Double precision number

Double (obsolete)

7

BCD number

Decimal

9

IBM BCD number

>10

Character string whose maximum length equals type - 10.

Char

The result of this function is an Integer type.

 

Associated errors

 

Error

Description

ERDOM (50)

The argument does not match a variable.

 

Associated key words

DIM - LIBELLE - SHORTINT - DATE - INTEGER - DECIMAL - CHAR


CONTENTS


Copyright © Sage 1999 - 2007