Rational Developer for System z
COBOL for Windows, Version 7.5, Programming Guide


Preparing OO applications

Use the cob2 command to link OO COBOL applications.

To prepare an OO COBOL client program for execution, link the object file to create an executable DLL module.

To prepare a COBOL class definition for execution:

  1. Link the object file to create an executable DLL module.

    You must name the resulting DLL module Classname.dll, where Classname is the external class-name. If the class is part of a package and thus there are periods in the external class-name, you must change the periods to underscores in the DLL module name. For example, if class Account is part of the com.acme package, the external class-name (as defined in the REPOSITORY paragraph entry for the class) must be com.acme.Account, and the DLL module for the class must be com_acme_Account.dll.

  2. Compile the generated Java source with the Java compiler to create a class file (.class).

For a COBOL source file Classname.cbl that contains the class definition for Classname, you would use the following commands to compile and link the components of the application:

Table 29. Commands for compiling and linking a class definition
Command Input Output
cob2 -c -qthread Classname.cbl Classname.cbl Classname.obj, Classname.java
cob2 -dll Classname.obj Classname.obj Classname.dll
javac Classname.java Classname.java Classname.class

After you issue the cob2 and javac commands successfully, you have the executable components for the program: the executable DLL module Classname.dll and the class file Classname.class. All files from these commands are generated in the current working directory.

Example: compiling and linking a COBOL class definition

related tasks
Compiling programs
REPOSITORY paragraph for defining a class

related references
cob2 options


Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)