GLOBALS statement is used to declare global variables, which can be referenced by any module or program block within a program.
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:
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.