Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

COBOL application programs on Windows systems

If you want to create application programs in COBOL, you use the compiler Visual Cobol from Microfocus. COBOL runtime licenses from MicroFocus are required for execution of programs that were compiled with a Micro Focus compiler.

Compiling application programs

Carry out the following steps to compile application programs:

  1. Setting environment variables

    >

    Call the command script <visualcoboldir>\base\bin\CreateEnv.bat.

    >

    Extend the COBCPY environment variable by adding the directory %UTMPATH%\copy-cobol85.

    >

    Extend the INCLUDE environment variable by adding <path>\include, where<path> is the installation directory of the COBOL compiler (required for the compilation of the root sources).

    >

    If you create programs based on CPIC, TX or XATMI under openUTM, extend the COBCPY environment variable by %UTMPATH%\<interface>\copy-cobol85, where <interface> stands for cpic, tx or xatmi.

    >

    If you create client programs based on UPIC-L, extend the COBCPY environment variable by adding %UTMPATH%\upicl\copy-cobol85.

  2. Open a command prompt window by choosing Start - Programs - Command Prompt, for example, and enter the command cobol. You then specify the source files interactively.

    You should also compile %UTMPATH%\src\mfcobol\MAINUTMCOB.cbl and use the resulting object.

    If you have installed the Quick Start Kit, you can also adapt the workcob.mak makefile to suit your specific requirements.

Linking application programs

Application programs are linked in two steps:

  1. Open a command prompt window and enter the command cblnames. In this case you specify all COBOL objects and other objects individually, e.g.
    %UTMPATH%\sys\MAINUTMCOB.OBJ and root.obj.

  2. Link the utmwork.exe program using the Microsoft linkage program LINK.
    The following objects must be integrated:

    • @cbllds.lnk (output of cblnames)

    • other application program libraries (if any)

    • %UTMPATH%\sys\libwork.lib (import library of UTM)

    • cblrtss.lib (Cobol runtime system)

    • C runtime system, e.g. msvcrt.lib kernel32.lib user32.lib gdi32.lib advapi32.lib

  • It may be necessary to set the LIB environment variable to the directories with these libraries.

    If the program is to be animated, it is necessary to specify the /BD switch.

    To define the COBOL main entry, it is necessary to use the /mMainUtm switch.

The options for both steps can simply be taken from the QuickStart Kit. The makefile for nmake is stored in the filebase directory under the name workcob.mak.

Please also note the compiler-specific programming notes in the manual openUTM manual „Programming Applications with KDCS” (chapter "Additional Information for Cobol", section "Platform-specific features on Windows systems").