Compiling OO applications under z/OS UNIX
When you compile OO applications in a z/OS® UNIX shell, use the cob2 command to compile COBOL client programs and class definitions, and the javac command to compile Java™ class definitions to produce bytecode (suffix .class).
About this task
To compile COBOL source code that contains OO syntax
such as INVOKE
statements or class definitions, or
that uses Java services, you
must use these compiler options: RENT
, DLL
, THREAD
,
and DBCS
. (The RENT
and DBCS
options
are defaults.)
A COBOL source file that contains a class definition must not contain any other class or program definitions.
When you compile a COBOL class definition, two output files are generated:
- The object file (.o) for the class definition.
- A Java source program (.java) that contains a class definition that corresponds to the COBOL class definition. Do not edit this generated Java class definition in any way. If you change the COBOL class definition, you must regenerate both the object file and the Java class definition by recompiling the updated COBOL class definition.
If
a COBOL client program or class definition includes the file JNI.cpy by
using a COPY
statement, specify the include
subdirectory
of the COBOL install directory (typically /usr/lpp/cobol/include) in
the search order for copybooks. You can specify
the include
subdirectory by using the -I
option
of the cob2 command or by setting
the SYSLIB environment variable.