Top > Lycia reference > Querix 4GL > Statements > GLOBALS
To meet your needs, we constantly work to improve Querix products.
This means that Lycia documentation is developing as well.
In case you have found a certain dissonance between the provided information and the actual behavior of Lycia 3 and/or your applications, please, let us know about this via documentation@querix.com so that we can introduce the necessary changes to our documentation.
Thank you for your attention and cooperation.
GLOBALS statement is used to declare global variables, which can be referenced by any module or program block within a program.
Element |
Description |
Declaration Clause |
The DEFINE statement where the global variables are declared |
There are four types of variables in Querix 4GL:
Variable Type |
Declare Location |
Scope of Reference |
Local |
Declared within a program block (MAIN, FUNCTION or REPORT) |
The block where it is declared |
Module |
Declared before any program block at the beginning of a program module |
The module where they are declared |
Global |
Declared with the help of the GLOBALS statement |
Any program module where the GLOBALS file is referenced |
Built-in |
They do not require declaration |
The entire 4GL application |
To declare a global variable, follow these steps:
Declare variables with the help of the GLOBALS statement in a separate file, that does not contain any program block other than the GLOBALS block
The DATABASE statement can precede the GLOBALS keyword in the GLOBALS file, if it is required
Specify the GLOBALS "filename" before any program block in modules, that reference global variables
The GLOBALS file must be compiled and linked to the other files of the program
It is possible to declare global variables in a program module that contains other program blocks besides the GLOBALS program block. However, the scope of reference of such variables will be only the module where they are declared. The file that contains other program blocks besides the GLOBALS cannot be referenced by the GLOBALS "filename" statement, because it includes executable statements.
The number of files that contain global variables is not limited, thus one program can have several GLOBALS files. More than one file containing global variables can be referenced with the help of the GLOBALS "filename" statement within one module.