Previous Topic Next topic Print topic


Overview - Integrated Preprocessor Interface

Note: The Integrated Preprocessor is supported for native COBOL only.

Language preprocessors (also known as precompilers) are used to convert non-standard COBOL, or non-COBOL code embedded in COBOL, into a form that the Compiler can process.

A non-integrated preprocessor takes as input a source file, reads and parses it, and produces a modified source file which is then passed as input to the COBOL compiler. This has the following disadvantages:

These factors can significantly lengthen the development cycle.

The Integrated Preprocessor Interface overcomes these problems by enabling the preprocessor to mark the relationship between the original source code and the modified form. Although the Compiler will actually process the modified COBOL, it will only ever show the original code.

The Integrated Preprocessor Interface enables a preprocessor to read source files and pass modified source lines to the Compiler. This makes the interface completely general purpose. The disadvantage of this approach is that the preprocessor itself has to handle COBOL constructs such as continuation, copybook expansion and the effects of REPLACE and REPLACING. Micro Focus provides the CP preprocessor, which can handle REPLACE and REPLACING, although this does require that COPY statements conform to normal COBOL syntax rules. If, by comparison, the Compiler read source files and passed single tokens to the preprocessor, restrictions such as the format of a token and the syntax of a COPY (or equivalent) statement would be imposed.

The underlying code that is actually compiled might be significantly different from the original. You might therefore notice that:

A supplied preprocessor reads and expands source files (including copybooks), and returns additional information to other preprocessors in the stack about the effect of REPLACE and REPLACING.

Previous Topic Next topic Print topic