Previous Topic Next topic Print topic


DECLARE

Purpose

Specifies the attributes associated with names.

Syntax

DECLARE declaration[,declaration]…;

Abbreviation(s): DCL for DECLARE.

Parameters

declaration

One or more declarations consisting of an identifier and attributes. The format of each declaration is:

[level]identifier[(bound-pair,…)][attribute…]

or

[level](declaration,…)[(bound-pair,…)] [attribute…] 

where:

level specifies the relationship of members of structures

bound-pair specifies the dimensions of arrays

attribute specifies one or more attributes of the identifier

If a level is specified, it must be written first in the declaration.

If a bound-pair is used, it must be in parentheses and must immediately follow the identifier or the parenthetical list of declarations.

The format of the DECLARE statement varies according to the number and nature of the items being declared. For example, the DECLARE statement can list one identifier and optionally specify a level, bound-pair list, and other attributes for that identifier. Or the statement can include, in parentheses, a list of declarations to which the level and all subsequent levels apply. The declarations in the second case can be simple identifiers or can include attributes that are specific to individual identifiers.

Description

The DECLARE statement specifies the attributes associated with names. This statement has five formats:

  • Simple declarations
  • Declarations outside of procedures
  • Multiple declarations
  • Factored declarations
  • Array declarations.

Each of these formats is described separately in the following sections. (for more information on attributes, see the chapter Declarations and Attributes.)

Restrictions

A DECLARE statement cannot be used as a THEN clause or ELSE clause of an IF statement or as the ON-unit of an ON statement. A DECLARE statement cannot be used in a WHEN or OTHERWISE clause of a SELECT statement.

Previous Topic Next topic Print topic