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".
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-elementREPLACING OBJECT-ID BY
NEW-OBJECT-ID.COPY
COPY-elementREPLACING RESTRICTED BY
NEW-RESTRICTED.COPY
COPY-ElementREPLACING 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 |
| Extend the COBCPY environment variable by adding If you create programs based on CPIC, TX or XATMI under openUTM, extend the |
| If you create client programs based on UPIC-L, extend the COBCPY environment |
| Set the COBMODE environment variable:
|
NetCOBOL
Perform the following steps if you use NetCOBOL program units:
| Call the script |
| Extend the COBCOPY environment variable by adding Set the COB_LIBSUFFIX environment variable to If you create programs based on CPIC, TX or XATMI under openUTM, extend the COB_COBCOPY environment variable as follows: |
| If you create client programs based on UPIC-L, extend the COB_COBCOPY environment variable by adding |
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”. |