Previous Topic Next topic Print topic


%ACTIVATE

Purpose

Renders identifiers active and eligible for replacement.

Syntax

%[label:]...ACTIVATE ident[SCAN|RESCAN|NORESCAN][,ident[SCAN|RESCAN|NORESCAN]]...;

Abbreviation(s): %ACT for %ACTIVATE.

Parameters

Each identifier must be a preprocessor variable, a preprocessor procedure name, or a preprocessor built-in function name.

Description

When a preprocessor variable is declared, it is automatically activated. It can be deactivated by use of the %DEACTIVATE statement and reactivated by use of the %ACTIVATE statement.

If RESCAN, SCAN or NORESCAN are not specified, RESCAN is assumed. RESCAN implies that after a text replacement has been made, text is rescanned to see if any further substitutions apply. SCAN and NORESCAN imply the opposite. SCAN is synonymous with NORESCAN.

The appearance of an identifier in a %ACTIVATE statement makes it active and eligible for replacement; that is, any subsequent encounter of that identifier in a nonprocessor statement, while the identifier is active, will initiate replacement activity, except when the identifier appears within a comment or within single quotes.

Example

Example 1.

%DECLARE A FIXED, B CHARACTER;
%DEACTIVATE B;
%A = 24;
%B = 'VAR_NAME'; 
NUM = B + A; 
%ACTIVATE B; 
%DEACTIVATE A; 
NUM = B + A;

The text generated by this example would be as follows:

NUM = B + 24;
NUM = VAR_NAME + A;

Example 2.

%DECLARE (C,D) CHARACTER;
%C = D**2;
%D = 'NUM';
NUM = C;
%ACTIVATE C NORESCAN;
NUM = C;

The text generated by this example would be as follows:

NUM = NUM**2; 
NUM = D**2;

Restrictions

A %ACTIVATE statement cannot appear within a preprocessor procedure. The replacement in a rescan operation is limited to 1023 characters.

References to preprocessor procedures will not be recognized when rescanning an identifier for replacement.

Previous Topic Next topic Print topic