Defining Application-Independent Variables

General syntax of DEFINE DATA INDEPENDENT:

DEFINE DATA
   INDEPENDENT [AIV-data-definition...]
END-DEFINE

This document covers the following topics:

For an explanation of the symbols used in the syntax diagrams, see Syntax Symbols.


Function

The DEFINE DATA INDEPENDENT statement is used to define application-independent variables (AIVs).

An application-independent variable is referenced by its name, and its content is shared by all programming objects executed within one application that refer to that name. The variable is allocated by the first executed programming object that references this variable and is deallocated by the LOGON command or a RELEASE VARIABLES statement.

The optional INIT clause is evaluated in each executed programming object that contains this clause (not only in the programming object that allocates the variable).

Note:
In an RPC server, application-independent variables (AIVs) are not deallocated implicitly, but stay active across RPC requests, because different clients may have access to the same variables on the RPC server. This means they must be deallocated explicitly using the RELEASE VARIABLES statement. See Application-Independent Variables in the Natural RPC (Remote Procedure Call) documentation.

Syntax Description

Syntax Element Description
INDEPENDENT AIV-data-definition
AIV Data Definition:

The DEFINE DATA INDEPENDENT statement can be used to define a single or multiple application-independent variables (AIVs). For each AIV, the syntax shown in AIV Data Definition applies.

END-DEFINE
End of DEFINE DATA Statement:

The Natural reserved word END-DEFINE must be used to end the DEFINE DATA statement.

AIV Data Definition

level

variable-definition

redefinition
handle-definition

Syntax Element Description:

Syntax Element Description
level
Level Number:

An application-independent variable must be defined at Level 01. Other levels are only used in a redefinition.

variable-definition
Variable Definition

A variable definition is used to define a single field/variable that may be single-valued (scalar) or multi-valued (array).

For further information, see Variable Definition.

Note:
The name of an application-independent variable must start with a plus (+) character.

redefinition
Redefinition:

With a redefinition, you can partition an application-independent variable into one or more subfields.

For further information, see Redefinition.

The subfields resulting from the redefinition must not be application-independent variables; that is, their name must not start with a plus sign (+). These fields are treated as local variables.

handle-definition
Handle Definition:

A handle identifies a dialog element in code and is stored in handle variables.

Note:
The first character of the name must be a plus (+). Rules for Natural variable names apply, see Naming Conventions for User-Defined Variables in Using Natural.