A preprocessor procedure is delimited by %PROCEDURE and %END statements. If the procedure is not defined with a RETURNS attribute, then it may not contain ANSWER statements, but it must not contain any RETURN statements. Conversely, if the procedure is a function, then it must contain at least one RETURN statement, and it must not contain any ANSWER statements.
The statements and groups that can be used within a preprocessor procedure are:
Preprocessor statements in a preprocessor procedure do not begin with a percent symbol.
Preprocessor procedures cannot be nested. A preprocessor ENTRY declaration is not permitted in a preprocessor procedure.
A preprocessor procedure entry name, together with the arguments to the procedure, is called a function reference. A preprocessor procedure can be invoked by a function reference in a preprocessor expression, or, if the function procedure name is active, by encountering a function reference in the preprocessor scan of input text. Preprocessor procedure entry names need not be specified in %DECLARE statements.
Provided its entry name is active, a preprocessor procedure need not be scanned before it is invoked. It must, however, be present either in:
The value returned by a preprocessor function (that is, the value of the preprocessor expression in the RETURN statement) replaces the function reference and its associated argument list in the preprocessor output.