You can structure applications that
use object-oriented COBOL syntax in one of three ways.
An OO application can begin with:
- A COBOL program, which can have any name.
You can run the program by specifying the name
of the executable module at the command prompt.
- A Java class definition that contains a method called main.
Declare main as public, static,
and void, with a single parameter of type String[].
You can run the application with the java command,
specifying the name of the class that contains main,
and zero or more strings as command-line arguments.
- A COBOL class definition that contains a factory method called main.
Declare main with no RETURNING phrase and
a single USING parameter, an object reference to a class that is an
array with elements of type java.lang.String.
(Thus main is in effect public, static, and void, with a single
parameter of type String[].)
You can run the application with the java command,
specifying the name of the class that contains main,
and zero or more strings as command-line arguments.
Structure an OO application this way if you want to:
- Run the application by using the java command.
- Run the application in an environment where applications must
start with the main method of a Java
class.
- Follow standard Java programming practice.
Examples: COBOL applications that run using the java command