Source code preprocessing
The isCOBOL Compiler offers the ability to preprocess COBOL source files either by providing replacement rules via regular expressions or by using preprocessor programs. In both cases the original source files remain unchanged, but the output files generated by the compiler (e.g. the source listing and the compiled class) will be affected by the modifications applied by the source code preprocessing.
Preprocessing the code via regular expressions is the easiest approach but it’s limited to the line level. It’s just a find-and-replace that the Compiler performs on each source line before parsing it. All the words of the searched string must appear on the same source line in order to be found. For more information on this approach, see
Source code preprocessing via regular expressions.
Preprocessing the code via preprocessor programs is a little trickier but it provides more possibilities. Although the line level approach is still used, the preprocessor program can keep track of previously processed lines so it can find text distributed on multiple lines and perform operations that are related to the context. For more information on this approach, see
Preprocessor programs.