Chapter 14: Introduction to the Class Libraries

This chapter introduces you to the Micro Focus class libraries supplied with your COBOL system, and tells you how you can find out more about them.

Overview

The following class libraries are supplied:

There are some references in the class library documentation to parts of the class libraries that are private. Wherever something private is documented, this is noted in the text. You should not subclass from private classes, or make use of private methods in your OO COBOL applications. Unless something in the documentation is marked as private, you can assume that it is part of the public interface. Public and private are explained in the sections below.

As well as this documentation, we supply the source code for the class libraries. We supply this for the following reasons:

Public and Private Interfaces

The public interface to the class libraries consists of those methods and classes in the class libraries that are intended for use by programmers creating OO COBOL applications.

The private interface to the class libraries consists of those methods and classes that are not intended for use by programmers using the class library. They are part of the implementation of the class libraries and are subject to change in future releases.

Private methods are marked as such in the comments to the class library source code.

The private interface also includes all class and instance data in class library objects. You should not make direct use of this data in any subclasses, but should use the methods in the superclass to get access to this data.

Class Library Method Parameter Types

Methods in the supplied Micro Focus Class Library consistently use the same COBOL data types for passing integers and boolean values. The table below summarizes these:

Parameter Declare as
Signed integers PIC S9(9) COMP-5.
Unsigned integers PIC X COMP-5
Booleans Booleans, where TRUE is numeric 1 and FALSE is numeric 0.

PIC S9(9) COMP-5 and PIC X(4) COMP-5 are both 4-byte data types.

For consistency, we suggest you adopt these conventions when writing your own classes.

Class Library Documentation

The documentation for the class libraries is split into two:

The frameworks are documented in this manual. The public interface to classes is documented in the Class Library Reference, which provides, for every class in the class libraries, a description of:

Private methods are not documented. Methods inherited from Base are not documented as all objects in the Base class Library inherit these, except where they have been explicitly overridden. You can see these methods, which are common to all objects, by looking at the documentation for the Base class.

The Class Library Reference is one of the books on your bookshelf

Frameworks

Frameworks are the way in which different types of object interact together. Individual class and instance objects have interfaces which describe the way you communicate with that object.

A framework is a protocol used by several different types of object co-operating to implement a particular function. The other chapters in this part of the book document the main frameworks used in the class libraries. For example, the chapter Collection Frameworks describes the messages a collection sends to its elements.

Animating the Class Libraries

You might want to be able to animate parts of the class libraries, possibly to help you understand how they work, or maybe to help you track down a bug in your own application. You can animate the following class libraries:

We strongly recommend that you only try to animate one or two class library programs at a time from your application.

The run-time system itself uses the class libraries during startup, so if you attempt to animate a whole class library you might find yourself stepping through code in which you are not interested before your application is loaded.

To animate the Base Class Library:

  1. Run the supplied shell script, $COBDIR/src/oops/bldclanm.sh to compile the class library for animation.
  2. Set the OOSW environment variable:
    OOSW=-l
    export OOSW

    This switch tells the run-time system not to load the class library supplied with Server Express, but to use the individual class library files you have just compiled. The class library files must either appear on the path set in the environment variable COBDIR, or in the current directory from which you run your application.

  3. Start animating your application.

    As you step through your application, whenever you step onto a statement which invokes a method in the Base Class Library, execution switches to animating through the class library code.

Warning: We strongly advise you not to make changes to the class library sources. Implementation details are considered private, and may change between releases. We do not prevent you from making these changes, but cannot guarantee that they will be supported in future releases.


Copyright © 2006 Micro Focus (IP) Ltd. All rights reserved.