DEFINE DATA - General

This document covers the following topics:


Function

The DEFINE DATA statement offers a number of clauses to declare data definitions for use within a Natural program, either by referencing predefined data definitions contained in a local data area (LDA), global data area (GDA) or parameter data area (PDA), or by writing in-line definitions.

Rules

  • When a DEFINE DATA statement is used, it must be the first statement of the program/routine.

  • An "empty" DEFINE DATA statement is not allowed; in other words, at least one clause (LOCAL, GLOBAL, PARAMETER, INDEPENDENT, CONTEXT or OBJECT) must be specified and at least one field must be defined.

  • You may specify more than one clause; in this case, the clauses must be specified in the order shown in the syntax diagrams.

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

Programming Modes

The DEFINE DATA statement is available in structured mode and in reporting mode. Differences are marked accordingly in the DEFINE DATA statement description.

Generally, the following applies:

Structured Mode

All variables to be used, except application-independent variables (AIVs), must be defined in the DEFINE DATA statement; they must not be defined elsewhere in the program. If a DEFINE DATA INDEPENDENT statement is used, AIVs must not be defined elsewhere in the program.

Reporting Mode

The DEFINE DATA statement is not mandatory since variables may be defined in the body of the program. However, if a DEFINE DATA LOCAL statement is used in reporting mode, variables, except application-independent variables (AIVs), must not be defined elsewhere in the program; and if a DEFINE DATA INDEPENDENT statement is used, application-independent variables (AIVs) must not be defined elsewhere in the program.

Further Information

For further information on the DEFINE DATA statement, see the following sections in the Programming Guide: