Version 4.2.6 for Mainframes
 —  Statements  —

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 Remote Procedure Call documentation.

Top of page

Syntax Description

INDEPENDENT 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 below applies.

END-DEFINE

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:

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

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

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

redefinition

A redefinition may be used to redefine a group, a view, a DDM field or a single field/variable (that is a scalar or an array). See Redefinition.

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

handle-definition A handle identifies a dialog element in code and is stored in handle variables. See Handle Definition.

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 the Using Natural documentation.

Top of page