Enterprise COBOL for z/OS, Version 4.2, Programming Guide

Writing object-oriented programs

When you write an object-oriented (OO) program, you have to determine what classes you need and the methods and data that the classes need to do their work.

OO programs are based on objects (entities that encapsulate state and behavior) and their classes, methods, and data. A class is a template that defines the state and the capabilities of an object. Usually a program creates and works with multiple object instances (or simply, instances) of a class, that is, multiple objects that are members of that class. The state of each instance is stored in data known as instance data, and the capabilities of each instance are called instance methods. A class can define data that is shared by all instances of the class, known as factory or static data, and methods that are supported independently of any object instance, known as factory or static methods.

Using Enterprise COBOL, you can:

In Enterprise COBOL programs, you can call the services provided by the Java Native Interface (JNI) to obtain Java-oriented capabilities in addition to the basic OO capabilities available directly in the COBOL language.

In Enterprise COBOL classes, you can code CALL statements to interface with procedural COBOL programs. Thus COBOL class definition syntax can be especially useful for writing wrapper classes for procedural COBOL logic, enabling existing COBOL code to be accessed from Java.

Java code can create instances of COBOL classes, invoke methods of these classes, and can extend COBOL classes.

It is recommended that you develop and run OO COBOL programs and Java programs in the z/OS UNIX environment.


Example: accounts

related references  
The Java Language Specification

Rate this page

[ Index | Table of contents ]