DECLARE - Outside of Procedure Format

Purpose

Allows a variable to be declared outside of any procedure and to be visible within all procedures contained in the module.

Syntax

DECLARE identifier[attribute];

Description

A variable can be declared outside of any procedure and will be visible within all procedures contained in the module (for more information, see the section Modules in the chapter Language Concepts). If no storage class is specified, STATIC is supplied by default.

The storage class for declarations outside of procedures cannot be AUTOMATIC.

Example

DECLARE B STATIC FIXED BINARY(31);
   .
   .
   .
SECOND: PROCEDURE;
   DECLARE C FIXED BINARY (31);
      .
      .
      .
THIRD: PROCEDURE;
   DECLARE D FIXED BINARY(31);
      .
      .
      .
END THIRD; 
END SECOND;

In this example, variable B can be referenced from both the SECOND and the THIRD procedure.

Restrictions

None.