Variable

Variable is a keyword used after a Subprog or a Func declaration, to define the type of arguments transmitted to the called code.

The declaration of the arguments is not mandatory. This allows you to transmit parameters with a variable type to subprograms. If they are present, the declarations must be placed just after the Subprog or Func declaration.

Variable arguments as transmitted through pointers: any modification done on the arguments is done on the variable transmitted to the call.

Syntax

Variable DECLARATION1 NAME(DIMENSIONS)
Variable DECLARATION2 NAME(SIZE)(DIMENSIONS)
Variable Instance NAME Using CLASS
Variable Instance NAME(DIMENSIONS) Using CLASS

The dimensions and the index ranges can be omitted wherever the parenthesis is present. The dimension and index ranges are defined by the calling program. Also, the first range of an index can only be given. The total number of values is defined by the calling program.

Examples

# Example of declarations
Subprog UPDATE_VALUES(KEYS,VALUES,IDENTIFIER,GLOBAL_STATUS)
Variable Char KEYS(20)(1..) : # Array of 20 characters starting at index 1
Variable Decimal VALUES(,) : # 2 dimensions matrix of decimals
Variable Char IDENTIFIER()
Variable Integer GLOBAL_STATUS : # Integer

# Example that brings to an error
Call MY_ERROR(123) : # Generates an error : constants or expressions are not allowed
....
End
Subprog MY_ERROR(MYVALUE)
Variable Decimal MYVALUE
...
End

See also

Global, Local, Value, Const, Tinyint, Libelle, Date, Shortint, Integer, Float, Double, Decimal, Char, Schar, Clbfile, Blbfile, Uuident, Datetime, Instance.