Creating COM Objects on Remote Network Servers

ACUCOBOL-GT includes a special verb to accommodate COM objects: CREATE. The Format 1 CREATE statement creates a new instance of a COM object. (Use the Screen section or Format 14 DISPLAY to create an instance of an ActiveX control.) See CREATE Statement for a detailed description of the CREATE statement.

If you have access privileges to do so, you can create a COM object on a remote-networked computer by passing the name of the computer in SERVER-NAME. That name is the same as the machine-name portion of a share name. For example, for a share named \\MyServer\Public, server name is MyServer. Note that CREATE cannot be used to create an object on a UNIX or VMS server. SERVER-NAME must be the name of a Windows machine.

The following code returns the version number of an instance of Excel running on a remote computer named MyServer:

CREATE Application of Excel 
    SERVER-NAME is "MyServer"
    HANDLE in xl-app.
INQUIRE xl-app Version in xl-vers.
DISPLAY xl-vers.

If the remote server does not exist or is unavailable, then an exception is raised and xl-app is set to NULL.

You might think of using CREATE if you want to use an ActiveX object that does not have a user interface. However, the CREATE verb does not create ActiveX controls. If you want to create an ActiveX control that does not have a visual representation on the screen, set VISIBLE = 0 in the DISPLAY statement or Screen section item. If you do not want any screen at all, create the initial window also with VISIBLE = 0.

The CREATE statement can be used with thin client applications to create instances of an object on the client or on remote Windows servers.

For instance, you can use the CREATE statement to provide Microsoft Office functions such as spell check and mail merge to end users. The clients must be Windows workstations, but they can be naked of all software except for Windows and the ACUCOBOL-GT Thin Client. The server running AcuConnect can be Windows, UNIX, or Linux. Note that clients must have execution privileges on the computer hosting Office, and use of the Office technology is subject to Microsoft licensing terms.

You use the Format 1 CREATE statement to create a remote instance of the desired application on the Windows computer hosting Office. When executed, your thin client application CREATEs the Office object on the Windows host, sends it instructions and data, gets results, then either displays results on the client or performs further processing on them.

Although CREATE cannot be used to create an object on a UNIX or VMS server, non-Windows servers running AcuConnect can provide connectivity to Windows servers in a multiple-tier configuration.