Function and Basic Syntax Rules

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.

General Syntax 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; at least one clause (GLOBAL, PARAMETER, LOCAL, INDEPENDENT, CONTEXT or OBJECT) must be specified.

  • You can specify more than one clause. However, if the GLOBAL and the PARAMETER clauses are used, GLOBAL must be the first clause of the statement and PARAMETER must follow GLOBAL (without GLOBAL, PARAMETER comes first if used). All other clauses can be specified in any order.

  • 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.