OO COBOL: Compiling and Linking
In short: it's a pain.
It took me only a couple of hours to get my first itty bitty OO programs
to compile -- one class definition and one program to drive it. It took
me about three days to get them to link and run.
Building an OO program involves far more than the usual compile-link-run
process. I haven't figured it all out yet, but the major pieces seem to
be as follows:
- For a class definition, the COBOL compiler writes a file in Interface
Definition Language (IDL), normally a member in an IDL library. IDL
is a specialized language, similar to C, for specifying class interfaces.
A DD statement in the compile step tells the compiler where to put the
IDL file.
- In a subsequent step, the SOM compiler compiles the IDL into
machine-readable gibberish, which it stores in an Interface Repository
(IR). There are also options whereby the SOM compiler can create header
files and program skeletons for C or C++ programs. If you're ambitious,
you can even coax the SOM compiler into writing something completely
different, such as documentation or ADA.
- There's a generic IR for built-in SOM classes. You're expected to
create one or more levels of separate IRs by installation, application,
and the like.
- Once the IR contains a representation of the class interface, the
COBOL compiler can consult it to verify that it is invoking the methods
with the right parameters.
- The compile step requires a DD statement for a profile which defines a
series of environmental variables. Among other things, these variables
tell the compiler which repositories to consult.
- The compiler puts the object code into an object library in the
usual way. However, in order to support names longer than eight
characters, you need to keep a special member in the library to map long
names to mangled eight-character names. You have to know how to invoke
the tools which maintain this mapping.
Different kinds of compiles need different kinds of JCL. Compiling a
class definition is different from compiling a client program, and each
is different from compiling a program which doesn't use objects. You
need to follow yet another procedure if two or more classes refer to
each other.
If you are adopting OO COBOL for the first time without an experienced
hand to guide you, the complexity of these procedures will be a substantial
obstacle.
Cobol Home
OO Cobol