Creating a DLL under z/OS UNIX

To create a DLL from the z/OS® UNIX shell, you must specify the cob2 option -bdll.


cob2 -o mydll -bdll mysub.cbl

When you specify cob2 -bdll:

  • The COBOL compiler uses the compiler options DLL, EXPORTALL, and RENT, which are required for DLLs.
  • The link step produces a DLL definition side file that contains IMPORT control statements for each of the names exported by the DLL.

The name of the DLL definition side file is based on the output file-name. If the output name has a suffix, that suffix is replaced with x to form the side-file name. For example, if the output file-name is foo.dll, the side-file name is foo.x.

To use the DLL definition side file later when you create a module that calls that DLL, specify the side file with any other object files (file.o) that you need to link. For example, the following command compiles myappl.cbl, uses the DLL option to enable myappl.o to reference DLLs, and links to produce the module myappl:


cob2 -o myappl -qdll myappl.cbl mydll.x

Example: using cob2 to compile and link under z/OS UNIX