Preprocessor statements are executed when encountered. You can:
If a preprocessor variable is not explicitly declared, a diagnostic message is issued and the variable is given the default attribute of CHARACTER. However, the variable is not activated for replacement unless it appears in a subsequently executed %ACTIVATE statement. The variable can be referenced in preprocessor statements.
Listing control statements that are not contained in a preprocessor procedure are copied into the preprocessor output, each on a line of its own.
The input text, after replacement of any active identifiers by new values, is copied into the preprocessor output. Invalid characters (part of a character constant or comment) are replaced with blanks in the preprocessor output. To determine replacements, the input text is scanned for:
An identifier that matches the name of an active preprocessor variable is replaced in the preprocessor output by the value of the variable.
When an identifier matches the name of an active preprocessor function (either programmer-written or built-in) the procedure is invoked and the invocation is replaced by the returned value.
Identifiers can be activated with either the RESCAN or the NORESCAN options. If the NORESCAN option applies, the value is immediately inserted into the preprocessor output. If the RESCAN option applies, a rescan is made during which the value is tested to determine whether it, or any part of it, should be replaced by another value. If it cannot be replaced, it is inserted into the preprocessor output; if it can be replaced, replacement activity continues until no further replacements can be made. Thus, insertion of a value into the preprocessor output takes place only after all possible replacements have been made.
Replacement values must not contain % symbols, unmatched quotation marks, or unmatched comment delimiters.
Preprocessor statements should be on separate lines from normal text. The one exception is the null statement when specified in the form %;. Such a null statement may be used to concatenate replacement text and regular text. For example, given the input text
%dcl A char; %A = 'B'; dcl A%C fixed bin(31);
the preprocessor would produce the output text
dcl BC fixed bin(31);
The scan terminates when an attempt is made to scan beyond the last character in the preprocessor input. The preprocessor output is then complete and compilation can begin.