The AXDEFGEN Utility

The role of AXDEFGEN is to locate the names of ActiveX controls and COM objects currently registered on the system and generate a COBOL COPY file for the control or object that you select. This COPY file is used by the ACUCOBOL-GT compiler for syntax and parameter type checking as well as efficient code generation. Where the control or object requires additional runtime licensing, AXDEFGEN also creates and embeds the required license key.

The COPY file contains a Special-Names Class definition for the ActiveX control/COM object. After generating the COPY file with AXDEFGEN, you must copy the COPY file into the COBOL program's Special-Names paragraph in the Environment Division/Configuration Section. Please note that the Special-Names paragraph must end with a period. However, the COPY file generated by AXDEFGEN does not end with a period. This is so other definitions can be made in the Special-Names paragraph after the COPY statement that copies this COPY file. To complete the paragraph, you must add a period.

The Special-Names Class definitions in the COPY file generated by AXDEFGEN contain all of the information the compiler needs to know about the ActiveX control or COM object. This eliminates the need for the compiler to read the system registry or instantiate the ActiveX control during compilation of the COBOL program. As a result, the COBOL program can be compiled later on a UNIX or VMS machine, or on a Windows machine that does not have the particular ActiveX control or COM object registered.

In order for the control to function in your COBOL program, you must add it to your program. For ActiveX, you typically modify the Screen section to include the name of the control's primary interface. This name can be determined by looking at the COPY file section ***Primary Interface***. Occasionally, you may want to create an ActiveX control in your Procedure Division. In this case, you use the DISPLAY statement.

Note: If you are using the AcuBench integrated development environment (IDE), you can drag the ActiveX control from the Screen Component Toolbox and drop it onto your screen in the Screen Designer. When run from AcuBench, AXDEFGEN automatically populates the toolbox with the ActiveX controls of your choice. see the AcuBench User's Guide for details.

To create a COM object, you add a CREATE statement to your program's Procedure Division. Unlike ActiveX controls, COM objects cannot be created using the Screen section or DISPLAY statement.