GLOBALS

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:

  1. 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.
  2. The DATABASE statement can precede the GLOBALS keyword in the GLOBALS file, if it is required.
  3. Specify the GLOBALS "filename" before any program block in modules, that reference global variables.
  4. 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.

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.