Tinyint

This keyword declares an integer variable where the value is within the range from 0 to 255.

Syntax

Local    Tinyint NAME
Local    Tinyint NAME(DIMENSIONS)
Variable Tinyint NAME(DIMENSIONS)
Value    Tinyint NAME(DIMENSIONS)
Const    Tinyint NAME(DIMENSIONS)
  • NAME is the name of the variable declared
  • DIMENSIONS can be:
    • a single numeric value DIM (meaning that we have an array with an index range from 0 to DIM-1)
    • a range of numeric values INDEX1..INDEX2 (the index varies between INDEX1 and INDEX2)
    • several indexes or index ranges separated by a comma (for multiple dimension arrays, up to 4 dimensions are possible)

Several variable declarations can be done on the same line, separated by a comma.

Local declarations create the variables in the current local variable class that is not seen by nested or calling sub-programs. The Call / Subprog, func / Funprog insulate the local variables, as well as the calls of method by fmet.

Const, Variable and Value declarations declare the arguments sent by a Call, func, or fmet. With these syntaxes, the dimensions and the index ranges can be omitted as soon as the parenthesis are present (the dimension and index ranges are defined by the calling program).

Example

# Direct declarations
Local Tinyint MYCHOICE,OTHERCHOICE : # Local tiny integer variables
Local TinyInt BYTES_ARRAY(1..1024) : # An array of 1024 byte values
# A sub-program sending tiny integers and returning a result
Funprog SEND_BYTES(MYCHOICE)
Variable Tinyint MYCHOICE(,) : # A 2 dimensions matrix of tiny integers is sent as references
...
End SEND_STATUS
# A sub-program storing tiny integers
Subprog STORE_BYTES(MYCHOICE)
Value Tinyint MYCHOICE(1..3) : # An array of 3 elements is sent (a copy is done when passing the arguments)
...
End

Comments

Tinyint replaces the Libelle keyword that still exists but is deprecated.

There is still a Global declaration variable that exists for variables that have to be seen in the scope of a process execution, but its use is strongly discouraged.

When using the L data type that stores enumeration in a class, the corresponding property has the Tinyint type.

Implicit data type conversion

The tinyint data type will implicitly convert Shortint, Integer, Float, Double and Decimal to a tinyint. For Decimal, Float and Double precision numbers the decimal portion of the number is truncated then the integer portion is assigned to the tinyint under the constraints that the integer portion of tinyint is limited to 0 to 255.
...


Local Tinyint MY_TINYINT # Declare Tinyint
MY_TINYINT = 255.43 # Float, Double or Decimal conversion - MY_TINYINT = 255

...

See also

GlobalLocalVariableValueConstShortintDateIntegerFloatDoubleDecimalCharClbfileBlbfileUuidentDatetimeInstance