Global

Global variables are variables that have a global visibility and duration scope in a Sage X3 process.

They are created in the [V] class. Once created, they will persist during the entire life of the Sage X3 process, unless they are destroyed by the Kill instruction.

It is recommended to avoid using this declaration and to replace it with a Local declaration because this variable is a barrier used to produce reentry code.

In previous versions of Sage X3, global variables were used to access optimization buffers for parameters. This has been replaced by the context structure even if a default context global pointer still exists ([V]GACTX).

The global variable is still used to define constants in order to avoid using literal or numeric constants in the code (for example, status values sent back by some instruction).

Syntax

Global DECLARATION1 VARIABLE(DIMENSIONS)Global DECLARATION2 VARIABLE(SIZE)(DIMENSIONS)Global Instance VARIABLE Using CLASSGlobal Instance VARIABLE(DIMENSIONS) Using CLASSDefault Global

'Default Global' establishes that a declaration without a Global or Local keyword will be considered global. This type of syntax should also be avoided because it makes the scope of the created variable ambiguous.

Examples

Global Char CONSTANT_STRING(100)Global Instance MYCONTEXT Using C_MYGLOBCLASSGlobal TinyInt STATUS_ARRAY(1..20)

See also

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