Defining a client
A program or method that requests services from one or more methods in a class is called a client of that class.
About this task
In a COBOL or Java™ client, you can:
- Create object instances of Java and COBOL classes.
- Invoke instance methods on Java and COBOL objects.
- Invoke COBOL factory methods and Java static methods.
In a COBOL client, you can also call services provided by the Java Native Interface (JNI).
A COBOL client program consists of the usual four divisions:
Division | Purpose | Syntax |
---|---|---|
IDENTIFICATION (required) |
Name a client. | Code as usual, except that a client program must
be:
|
ENVIRONMENT (required) |
Describe the computing environment. Relate class-names used in the client to the corresponding external class-names known outside the compilation unit. | CONFIGURATION SECTION (required) |
DATA (optional) |
Describe the data that the client needs. | DATA DIVISION for defining a client (optional) |
PROCEDURE (optional) |
Create instances of classes, manipulate object reference data items, and invoke methods. | Code using INVOKE , IF ,
and SET statements. |
Because you must compile all COBOL programs
that contain object-oriented syntax or that interoperate with Java with the THREAD
compiler
option, you cannot use the following language elements in a COBOL
client:
SORT
orMERGE
statements- Nested programs
Any programs that you compile with the THREAD
compiler
option must be recursive. You must specify the RECURSIVE
clause
in the PROGRAM-ID
paragraph of each OO COBOL client
program.
Related tasks
Compiling, linking, and running OO applications
Preparing COBOL programs for multithreading
Communicating with Java methods
Coding interoperable data types in OO COBOL and Java
Creating and initializing instances of classes
Comparing and setting object references
Invoking methods (INVOKE)
Invoking factory or static methods
Compiling, linking, and running OO applications
Preparing COBOL programs for multithreading
Communicating with Java methods
Coding interoperable data types in OO COBOL and Java
Creating and initializing instances of classes
Comparing and setting object references
Invoking methods (INVOKE)
Invoking factory or static methods