Structuring OO applications
You can structure applications that use object-oriented COBOL syntax in one of three ways.
About this task
An OO application can begin with:
- A COBOL program, which can have any name.
Under z/OS® UNIX, you can run the application by specifying the name of the linked module (which should match the program name) at the command prompt. You can also bind the program as a module in a PDSE and run it in JCL using the
EXEC PGM
statement. - A Java™ class definition
that contains a method called
main
. Declaremain
aspublic
,static
, andvoid
, with a single parameter of type String[].You can run the application with the
java
command, specifying the name of the class that containsmain
, and zero or more strings as command-line arguments. - A COBOL class definition that contains a factory method called
main
. Declaremain
with noRETURNING
phrase and a singleUSING
parameter, an object reference to a class that is an array with elements of type java.lang.String. (Thusmain
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 containsmain
, 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 (such as a Java dependent region). - Follow standard Java programming practice.
Examples: COBOL applications that run using the java command