Preprocessor facilities
The compiler provides a MACRO preprocessor for source program alteration. When you specify the MACRO or PP(MACRO) compile-time option, the preprocessor is executed before compilation. The MACRO preprocessor scans the preprocessor input and generates preprocessor output. The preprocessor output can serve as input to the compiler.
This description of the preprocessor assumes that you know the PL/I language described throughout this publication.
The preprocessor input is a string of characters consisting of intermixed preprocessor statements, listing control statements, and input text:
- Preprocessor statements
- Preprocessor
statements1 are executed
as they are encountered by the preprocessor scan (with the exception
of preprocessor procedures, which must be invoked in order to be executed).
Preprocessor statements, except those in preprocessor procedures,
begin with a percent symbol (%). Using a blank to separate the percent
symbol from the rest of the statement is optional.
The preprocessor executes preprocessor statements and alters the input text accordingly. Preprocessor statements can cause alteration of the input text in any of the following ways:
- Any identifier (and an optional argument list) appearing in the input text can be changed to an arbitrary string of text.
- You can indicate which portions of the input text to copy into the preprocessor output.
- A string of characters residing in a library can be included in the preprocessor input.
- Listing control statements
- Listing control statements control the layout of the printed listing of the program. These statements affect both the insource listing (the preprocessor input) and the source listing (the preprocessor output). For information about listing control statements, see Statements and directives.
- Input text
- The input text is preprocessor input that is not a preprocessor statement or a listing control statement. The input text can be a PL/I source program or any other text, provided that it is consistent with the processing of the input text by the preprocessor scan.
Preprocessor output2 is a string of characters consisting of intermixed listing control statements and output text:
- Listing control statements
- Listing control statements that are scanned in the preprocessor input are copied to the preprocessor output.
- Output text
- Input text that is scanned and possibly altered is placed in the preprocessor output.
You can specify compile-time options that cause the preprocessor input, the preprocessor output, or both to be printed or written to a data set.