Sample Integrated Preprocessor [ Micro Focus COBOL System Reference, Volume 1 ] MPE/iX 5.0 Documentation
Micro Focus COBOL System Reference, Volume 1
Sample Integrated Preprocessor
Two example integrated preprocessors which have been designed to be
stacked are included with your sample programs on this COBOL system for
DOS, Windows and OS/2. They are provided as COBOL source programs
together with a source program and a COPY-file for them to process.
(DOS, Windows and OS/2)
The name of the example preprocessor programs are PREPROC.CBL and
PREPROX.CBL.
The example preprocessors can be used as a basis for other preprocessors.
They demonstrate how:
* the preprocessor is invoked and opens source input
* source is passed without editing to the Compiler
* source is edited and then passed to the Compiler
* lines containing more than one verb are expanded
* COPY statements are processed
* warnings and errors are produced
* preprocessors can be stacked
Specification of the Example Preprocessors
The example preprocessors recognize and process several verbs as follows:
* MOV is converted to MOVE
* DIS is converted to two lines, the first being DISPLAY SPACE UPON
CRT and the second containing the original line with the word DIS
replaced by DISPLAY
* PRINT is converted to DISPLAY
* CPY is converted to COPY, and thus expanded by the Checker: COPY
is expanded by the preprocessor
* WARN causes a warning message to be placed in the listing file
* ERROR causes a serious error message to be displayed and the user
to be asked whether compilation should continue. If a positive
response is received, the serious error count is increased.
In order to demonstrate stackable preprocessors, these functions are
split into two separate programs. The two preprocessors are very
similar, containing much common code.
The preprocessors include an example of a lexical analyzer for COBOL,
which will handle lexical tokens which do not continue across records.
MPE/iX 5.0 Documentation