The %DECLARE statement establishes an identifier as a macro variable, macro procedure, or built-in function. In addition, scanning status can be specified for macro variables.
|
Or
Abbreviations: %DCL for %DECLARE, CHAR for CHARACTER, INT for INTERNAL, EXT for EXTERNAL
The declaration activates the entry name.
The declaration of a preprocessor procedure entry name can be performed explicitly by its appearance as the label of a %PROCEDURE statement. This explicit declaration, however, does not activate the preprocessor procedure name.
Under the (default) FIXED(DECIMAL) option, it is also given the attributes DECIMAL(5,0).
Under the FIXED(BINARY) option, it is also given the attributes BINARY(31,0).
Note: While an array may be declared outside of a preprocessor procedure (so that it can be shared across multiple procedures), it may not be referenced outside a procedure (except as the first argument to one of the array-enquiry built-in functions).
An array bound might be specified by an integer constant or by a more general expression. The general expression must not depend on the value of other preprocessor variables, but it might depend on other attributes such as the bounds of other variables. For example, the following declarations are valid in this order:
%dcl a(2) fixed; %dcl b(2+hbound(a)) fixed;
And the following declaration is also valid when sysparm is an integer constant:
%dcl c( sysparm() ) fixed;
All variables declared outside a procedure are EXTERNAL, and all variables declared inside a procedure are INTERNAL.