Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

Platform-specific features on Unix and Linux systems

You can create COBOL programs either with the compilers from Micro Focus or with the Fujitsu NetCOBOL compiler.

This subsection describes the following compiler-specific characteristics:

  • Generation

  • Keywords

  • Environment variables

  • Compilation of COBOL program units

For details on linking applications and generating shared objects, see the manual openUTM manual “Using UTM Applications on Unix, Linux and Windows Systems”, subsection "Linking a UTM process on Unix and Linux systems".

All the programs in the openUTM sample application are suitable for use with the various COBOL compilers. The appropriate environment is set depending on the selected COBOL compiler.

Generation

At generation, you must specify the following KDCDEF statement for these programs:

  • Micro Focus COBOL:

    PROGRAM objectname, COMP=MFCOBOL [,SHARED-OBJECT=shared_object_name]

  • NetCOBOL:

    PROGRAM objectname, COMP=NETCOBOL [,SHARED-OBJECT=shared_object_name]

Keywords

Micro Focus COBOL and NetCOBOL

COBOL compilers include the keywords OBJECT-ID, RESTRICTED and USER. These keywords clash with names in the COPY elements of the UTM interfaces. There are two ways of preventing such conflicts.

  • If the COBOL program units are not object-oriented, some compilers offer the possibility to specify the compiler options REMOVE(OBJECT-ID), REMOVE(RESTRICTED) and REMOVE(USER) at compilation.

  • If the compiler does not provide the REMOVE functionality or if you want to preserve object-oriented functionality, you must modify the COPY statements as follows, for example:

    COPY COPY-element REPLACING OBJECT-ID BY NEW-OBJECT-ID.
    COPY COPY-element REPLACING RESTRICTED BY NEW-RESTRICTED.
    COPY COPY-Element REPLACING USER BY NEW-USER.

    The new names must be used when data access is performed.

NetCOBOL

Both the COBOL copies supplied by openUTM (KCAUSERC and KCAUSD2C) contain a structure field named PASSWORD.

Because PASSWORD is a reserved word in the NetCOBOL compiler, a REPLACING statement must be added when including these files in the COBOL source, e.g.

COPY KCAUSERC REPLACING PASSWORD BY PASSWORD-NC.

Reserved keyworda when CPIC is used

In MicroFocus COBOL, TIMEOUT is a reserved word. However, since this word is contained in the COBOL copy CMCOBOL on account of the CPIC specification, this name must be replaced in the source. For example:

COPY CMCOBOL REPLACING TIMEOUT BY CPIC-TIMEOUT.

Environment variable

Micro Focus COBOL

Perform the following steps if you use COBOL program units with Micro Focus COBOL:

>

Call the script <coboldir>/bin/cobsetenv.
This script sets the required environment variables for the compiler.

>

>

Extend the COBCPY environment variable by adding $UTMPATH/copy-cobol85.

If you create programs based on CPIC, TX or XATMI under openUTM, extend the
COBCPY environment variable as follows:
$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.

>

Set the COBMODE environment variable:

  • To generate 32-bit objects, set it to 32.

  • To generate 64-bit objects, set it to 64.

NetCOBOL

Perform the following steps if you use NetCOBOL program units:

>

Call the script <COBOLDIR>/config/cobol.sh.
This script sets the required environment variables.

>

>

>

Extend the COBCOPY environment variable by adding $UTMPATH/netcobol.

Set the COB_LIBSUFFIX environment variable to None,CPY,cpy.

If you create programs based on CPIC, TX or XATMI under openUTM, extend the COB_COBCOPY environment variable as follows:
$UTMPATH/<interface>/netcobol, where <interface> stands for cpic, tx or xatmi.

>

If you create client programs based on UPIC-L, extend the COB_COBCOPY environment variable by adding $UTMPATH/upicl/netcobol.

Compiling a COBOL program unit

Micro Focus COBOL

Micro Focus COBOL source programs are compiled with cob. You will need to set the following switches:

-c to create an .o file

-x for static linking

-g to retain the symbol table during linkage

NetCOBOL

NetCOBOL source programs are created with cobol. To do this, specify the following switches:

cobol -c WC'LIST,SOURCE,XREF,MESSAGE,COPY(FULL),SRF(VAR,FIX)' P'cobolprogramm.lst' cobolprogramm.cbl (to create a .o file)

For more details of creating UTM applications with COBOL programs, please refer to the openUTM manual “Using UTM Applications on Unix, Linux and Windows Systems”.