Operation [ COBOL/HP-UX Operating Guide for the Series 700 and 800 ] MPE/iX 5.0 Documentation
COBOL/HP-UX Operating Guide for the Series 700 and 800
Operation
This section describes how to invoke and test existing preprocessors and
how to write one of your own.
Limitations
The close integration of the preprocessor with the Compiler enables
changed source code to be hidden from the user. This can be a
disadvantage in instances where components rely on a strict relationship
between the intermediate code created by the Compiler and the COBOL
statements in the source file, because such components will not always
operate as documented when an integrated preprocessor is used. For
example, if you use the XREF Compiler directive,
the cross reference listing will be inaccurate since cross reference
information for code inserted by the preprocessor will not be shown even
if the original source line referenced the same data items.
Invoking a Preprocessor
You invoke a preprocessor
through the simple use of a Compiler directive. For details on
specifying Compiler directives, see Chapter 3 , Compilings. You
should enter:
-C preprocess "preprocessor-name param-1 param-2 ..."
where
preprocessor-name is the name of the preprocessor
param-1 param-2 ... are the preprocessor parameters or directives.
All directives on the command line following the PREPROCESS directive and
up to the end of the line, or the
END directive, are passed to the preprocessor without examination.
In a similar manner to other compiler directives, the PREPROCESS
directive can be either placed in a directives file (for example the
default cobol.dir file) or included in a $SET statement within the source
code. It should not be specified in more than one place. If it is in a
$SET statement, it must be the first line in the source file.
Testing a Preprocessor
The preprocessor program should be compiled in the same manner as any
other program you wish to animate. Then you use Animator as though you
wish to animate the Compiler itself.
You should enter:
set COBSW=+A
export COBSW
You will not see the Compiler animated since it is not compiled for
animation, but you will see any programs it calls that have been, such as
your preprocessor.
From the command line enter:
cob prog.cbl [directives]
preprocess(preprocessor-name) ...
where :
prog.cbl is the name of the source code
directives are one or more compiler directives
preprocessor-name is the name of the preprocessor
... are any parameters for the preprocessor.
Invoking Multiple Preprocessors.
The command line for invoking several preprocessors is of the format:
cob prog.cbl -C" preprocess(pre-1) [p1 ...]
[preprocess(pre-2) [p2 ...]
where:
prog.cbl is the name of the source file
pre-1 is a preprocessor invoked by the Compiler
p1 ... are optional directives for pre-1
pre-2 is a preprocessor invoked by pre-1
p2 ... are optional directives for pre-2
MPE/iX 5.0 Documentation