Previous Topic Next topic Print topic


DECLARE - Factored Format

Purpose

Allows two or more names that have the same attribute to be combined into a single, factored declaration.

Syntax

DECLARE(identifier[,identifier…])[attribute…];

Parameters

Names that share common attributes can be placed within parentheses and must be separated with commas. The attributes that follow the parenthetical list of names are applied to all of the named identifiers.

You can also specify, within the parentheses, attributes that are unique to specific variable names using the following format:

DECLARE(identifier[attribute]…,identifier[attribute]…)attribute…;

Description

When two or more names have the same attribute, you can combine the declarations into a single, factored declaration. (For more information on attributes, see the chapter Declarations and Attributes.)

Example

DECLARE (COUNTER, RATE, INDEX) FIXED BINARY (6) INITIAL (0);

In this example, the variables COUNTER, RATE, and INDEX share the attributes FIXED BINARY (6) and are given the initial value of zero.

DECLARE (INFILE INPUT RECORD, OUTFILE OUTPUT STREAM) FILE;

In this example, the DECLARE statement declared INFILE as a RECORD INPUT file and OUTFILE as an OUTPUT STREAM file.

Parentheses can be nested, as shown in the following example.

DECLARE ((INFILE INPUT, OUTFILE OUTPUT) RECORD, SYSFILE STREAM) FILE;

In this example, the DECLARE statement declares INFILE as a RECORD INPUT file, OUTFILE as a RECORD OUTPUT file, and SYSFILE as a STREAM INPUT file (STREAM implies INPUT).

Restrictions

None.

Previous Topic Next topic Print topic