Natural for Mainframes Version 8.2.5 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 Natural objects executed within one application that refer to that name. The variable is allocated by the first executed Natural 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 Natural object that contains this clause (not only in the Natural 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.

Top of page

Syntax Description

Syntax Element Description
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

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.

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.

Top of page