OO COBOL: Overview

In OO COBOL there are three kinds of programs. I have summarized IBM's syntax for each (consult the manuals for further details):
  1. class definitions
  2. method definitions
  3. client programs
A class definition is similar to an ordinary program. It has the usual four divisions, but with various special features.

In particular, the PROCEDURE DIVISION doesn't contain procedural code in the usual way. Rather, it contains all of the code for all of the methods of the class. Each method definition has four divisions of its own, and its PROCEDURE DIVISION contains the procedural code.

Because of this arrangement, it isn't possible to define some methods in one source file and others in another. All method definitions for a class must reside in the same source file. A class with many complex methods may require an unusually large source file.

A client program may be an ordinary program or a method definition. It uses the INVOKE verb to execute a method, rather than CALL.

Defining a subclass is no different from defining a base class. In fact every class is a subclass, except for the built-in class SOMObject.

A class may itself be an instance of a metaclass -- a class of classes. You can define your own metaclasses, derived from SOMClass. Since a metaclass is just another kind of subclass, the syntax is the same as for any other subclass.


[home]Cobol Home [OOC]OO Cobol