PreviousCompiling and Shipping OO Applications Collection FrameworksNext"

Chapter 26: Introduction to the Class Library

Object COBOL is supplied with a class library of predefined classes which you can use and subclass. This chapter introduces you to the Object COBOL Class Library, and tells you how you can find out how to use it.

26.1 Overview

The Object COBOL Class Library provides you with a set of classes to help you write your own applications faster. There are broadly four categories of class in the supplied Class Library:

The Class Library does not yet include classes for handling COBOL files. Object COBOL supports full COBOL file handling syntax, and you can use this in your classes and programs to read and write to COBOL file types. Micro Focus will only release COBOL file handling classes when satisfied that they provide a worthwhile enhancement to COBOL file handling technology, and that their architecture will allow for further improvements in the future.

There are some references in the Class Library documentation to parts of the Class Library which 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 Object 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 Object COBOL class library. We supply this for the following reasons:

26.1.1 Public Interface

The public interface to the Class Library consists of those methods and classes in the Class Library which are intended for use by programmers creating Object COBOL applications.

26.1.2 Private Interface

The private interface to the Class Library consists of those methods and classes not intended for use by programmers using the class library. They are part of the implementation of the class library 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.

26.2 Class Library Documentation

The documentation for the Class Library is split into two:

The frameworks are documented in this manual. The public interface to classes is documented in the on-line Object COBOL Class Library Reference. For every class in the Class Library, the on-line Object COBOL Class Library Reference provides you with:

Private methods are not documented. Methods inherited from Base are not documented as all objects from the 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.

26.3 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 this Class Library. The information will help you to use the Class Library efficiently. For example, the chapter Collection Frameworks describes the messages a collection sends to its elements.

26.4 Animating the Class Library

You might want to be able to animate parts of the Class Library, possibly to help you understand how it works, or maybe to help you track down a bug in your own application. We strongly recommend that you only try to animate one or two class library programs at a time from your application.

Object COBOL itself uses the Class Library during startup, so if you attempt to animate the whole Class Library you might find yourself stepping through code in which you are not interested before your application is loaded.

16-bit:
On 16-bit COBOL systems, you might also run into memory problems when trying to animate many programs at a time.

>>Windows and OS/2 :
To animate the class library

  1. Start the COBOL Class Browser and load the Class Library (you can do this from an icon in the Object COBOL group on your desktop).

  2. Select Check from the Options menu, and change the command line for checking programs to:
    [xm] cobol % omf"gnt";

    16-bit:
    On 16-bit COBOL systems, you only need to use xm if you are running on Windows.

  3. Select Check All from the COBOL menu.

    This creates native code .gnt files for all the programs in the class library.

  4. Delete the .gnt files for the classes you want to animate.

  5. Select Check from the Options menu, and change the command line for checking programs back to:
    [xm] cobol % editor(mf) anim nognt mfoo;

    16-bit:
    On 16-bit COBOL systems, you only need to use xm if you are running on Windows.

  6. Select a class you want to animate, and select Check from the COBOL menu. Repeat this step for all the classes you want to animate.

  7. Set the OOSW environment variable:
    set oosw=-l

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

  8. Run your application.

>>UNIX:
To animate the class library

  1. Run the supplied shell script, 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 class.lbr, but to use the individual class library files you have just compiled. The class library files must either appear on the path set in COBDIR, or in the current directory from which you run your application.

  3. Run your application.


Warning: We strongly advise you not to make changes to the Class Library sources. Implementation details are considered private, and may change between Object COBOL releases. Micro Focus does not prevent you from making these changes, but cannot guarantee that they will be supported in future releases.



Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousCompiling and Shipping OO Applications Collection FrameworksNext"