Compatibility Topics
cobmf
Overview of cobmf
cobmf provides the user with an emulator that recognizes an important subset of the compiler flags supported by the Micro Focus COBOL compiler (cob). When using cobmf, it is important to understand the following:
- Cobmf is not a perfect emulator. It has limitations. Some cob flags are supported and some are ignored. See the Table of Compiler Flags below for a guide to supported options.
- In cases where a cob flag is ignored, there may be a work-around using the
-CIT
"COBOLIT compiler flag" device. We have included some suggestions in the Table of Options below, and also included remarks on using-CIT with cobmf
(see the Using the -CIT option with cobmf section for more details. -
There are minor differences in the implementation of the -C directive with cobmf. As an example:
- In Micro Focus COBOL:
cob --C sign"ebcdic" program1.cbl
- Using cobmf:
cobmf --C sign\"ebcdic\" program1.cbl
, ORcobmf --C sign="ebcdic" program1.cbl
- In Micro Focus COBOL:
-
In the end, it is very useful to understand what cobmf does. As an emulator, cobmf translates your Micro Focus COBOL command line into a COBOL-IT command line. Some compiler flags will be translated into command-line compiler flags. Some will be translated into settings in a compiler configuration file that is generated along with the command.
For details, see the What cobmf does section below for more details.
>cobmf [return]
Note
For a full list of the [options]
supported by cobmf, type cobmf [return]
at the command line.
Usage:
cobmf [options] files
Cobmf Options
Cobol-IT MF compatible cob
Cobol-IT MF compatible caller usage:
cob [options]
files
options are:
Option | Description |
---|---|
-a | ignored |
-C directive | Pass syntax-check phase directive to the Compiler |
-CC option | Pass option to the C Compiler |
-CIT option | Pass option to the CIT cobc Compiler |
-Q option | Pass option to the Linker |
-c | Compile no further than a linkable object module (.o) |
-g | Create debugging information |
-I dir | Where are stored copy book |
-i | Compile to .int code for unlinked environment |
-k cobol-file | Recognize COBOL source file with non-standard filename extension |
-L dir | Pass option to system linker,changing search algorithm and maintaining relative ordering |
-l lib | Pass option to system linker, maintaining relative ordering |
-m symb=newsym | Map text symb onto newsym |
-O | Enable optimization |
-o filename | Specify output filename |
-P | Produce COBOL compilation listing file |
-u | Compile to .gnt code for unlinked environment |
-V | Report version number |
-v | Set verbose mode |
-W err-level | Control error level for cob termination |
-x | Process to system executable file |
-Z | Process to shared library |
Using the -CIT option with cobmf
The -CIT
command line option is used to pass additional commands to the COBOL-IT compiler when using cobmf command line emulator.
Usage:
cobmf -CIT "-v -Os -O" myprog.cob
Note
After including the -CIT
option, you just list the COBOL-IT compiler flags, inside quotes, that you would like the COBOL-IT compiler to use in addition to those implied by the usage of the listed Micro Focus compiler flags.
What cobmf does
To examine what cobmf does, an example:
First, compile a simple hello.cbl
program using cobmf:
In Windows:
> cobmf -L%COBOLITDIR%\lib hello.cbl
Cobol-IT MF compatible cob.
Running:
cobc -l citextfh_dll.lib -LC:\Cobol\CobolIT\
lib -conf=hello.mfconf -fmf-int hello.cbl
cob1D5F8608_1.c
Creating library hello.lib
and object hello.exp
.
Breaking down the command line, we see:
Command | Description |
---|---|
cobc | The emulator has substituted the COBOL-IT compiler for cobmf |
-l citextfh_dll.lib | In Micro Focus emulation mode, the extfh interface is enabled |
-LC:\Cobol\CobolIT\lib | In Windows, you must point to the library where the extfh interface library is located. Since COBOL-IT supports the -L <lib> compiler flag, no translation was necessary. |
-conf=hello.mfconf | hello.mfconf is a compiler configuration file that is generated by the emulator, and which, at a minimum, references the Micro Focus compatibility mode, and may, depending on the compiler options selected, contain other entries. This is a minimal case, so the contents of hello.mfconf are simply: include "mf.conf" |
-fmf-int | In Micro Focus emulation mode, an output file with a .int extension is created. The output file with the .int extension is an abbreviated list file. |
hello.cbl | The name of the program. |
How cobmf handles the -C "[directive]" compiler flag
As you use the -C"[directive]"
compiler flag with cobmf, follow these rules:
- Place a forward slash "/" before quotes
- Directives are translated into equivalent compiler configuration file entries. After running the command, check the contents of the "conf" file generated by the emulator, to view how your directive has been translated.
Consider the common case where the defaultbyte"0"
directive is passed to the compiler on the command-line.
In Micro Focus:
cob –C defaultbyte”0” hello.cbl
In COBOL-IT, construct the command as follows:
C:\COBOL\CobolIT>cobmf -C defaultbyte\"0\" -L%COBOLITDIR%\lib hello.cbl
Cobol-IT MF compatible cob.
Running:
cobc -l citextfh_dll.lib -L C:\Cobol\CobolIT\lib
-conf=hello.mfconf -
fmf-int hello.cbl
cob4AA78944_1.c
Creating library hello.lib
and object hello.exp
.
Check the contents of hello.mfconf
Note
The key adjustment that has been made by the emulator is in the compiler configuration file, which now has the following contents:
include "mf.conf"
use-defaultbyte:yes
defaultbyte:0
COBOL-IT requires that two compiler configuration file entries be set for the DEFAULTBYTE
directive, the use-defaultbyte
entry, and the defaultbyte
entry, which captures the value of the defaultbyte
.
COBOPT
The COBOPT environment variable is supported by cobmf. The COBOPT environment variable stores command-line compiler flags, for use with cobmf.
Table of equivalents to cob compiler flags
Cob flag | Function | COBOL-IT Equivalent |
---|---|---|
-A [as option] | Pass as_option to Assembler | Not supported. |
-a | Compile for animation | -g |
-C [directive] | Pass syntax-check phase [directive] to the compile | Difference. Cobmf provides a limited Compiler ability to use. However, best practice is to determine the analogous compiler configuration setting, and update your compiler configuration file. See the Table of Directives. |
-CC [cc option] | Pass [cc option] to the "C" Compiler | -Wc [cc option] |
-c | Compile no further than linkable object module (.o) | -c |
-d[symb] | Dynamically load [symb] | Difference. Use COB_LIBRARY_PATH to locate dynamically loaded module. |
-e[symbol] | Set initial entry point to [symbol] | Not required. |
-g | Produce debugging nformation | -g |
-I [symbol] | Include [symbol] in executable module | Difference. Statically link [symb]:>cobc -x -o hello [symb1][symb2] -I [dir] |
-i | Compile to .int code | Creates a shared object with a .int extension. The shared object is only renamed. |
-k [COBOL src file] | Compile [COBOL src file] with non-standard extension | Not required. |
-L[dir] | Pass [dir] to system linker, changing search algorithm and maintaining relative ordering | -L [dir] |
+L[dir] | Pass [dir] to system linker after all other options, changing search algorithm | Not supported |
-l[lib] | Pass [lib] to system linker, maintaining relative ordering | -l[lib] |
+l [lib] | Pass option to system linker after all other options | Not supported |
-m symb=newsymb | Map symb to newsymb | Not supported |
N.[directive] | Pass generate-phase [directive] to compiler | Difference. Cobmf provides a limited ability to use. However, best practice is to determine the analogous compiler configuration setting, and update your compiler configuration file. See the Table of Directives. |
-O | Enables optimization | -O |
-o[file] | Specifies output [file] name | -o [file] |
-P | Produce COBOL listing file with compilation | -t |
-p | Instructs "C" compiler to use profiling routines. | -fprofiling |
-Q [ld option] or | Pass [ld option] to linker | -Wl [ld option] |
-Q, 1 [ld option] or | ||
-Q, 2 [ld option] | ||
-t | Creates multi-threading programs | -fthread-safe |
-U | Dynamically load unresolved symbols | Not supported |
-u | Compile to .gnt code | fmf-gnt |
-V | Returns version number | -V |
-v | Sets verbose mode | -v |
-W[error level] | Sets [error level] at which compiler aborts | -w compiler flags |
-X[symb] | Excludes [symb] from executable output file | Not supported |
-x | Produce executable file | x |
-x,CC | Produce executable file with C++ support | Not required |
-y | Produce self-contained callable shared object. | -m |
-z | Produce callable shared object | -m |
-z,U | Produce callable shared object and issue error if there are undefined symbols | -m |
-z,CC | Produce callable shared object with C++ support | -m |
-Z | Produce shared library | -b |
-Z,CC | Produce shared library with C++ support. | -b |
Table of equivalents to compiler directives
Micro Focus Directive | What it does | COBOL-IT Equivalent |
---|---|---|
ACCEPTREFRESH | Causes data areas associated with Screen Section items to be updated from their corresponding Working-Storage Section items before an ACCEPT statement. | -faccept-with-update compiler flag or accept-with-update: yes |
ALIGN | Sets memory boundaries on which data items of level-01 or level-77 are aligned. | -falign-8 compiler flag align-8:yes |
ALTER | Permits ALTER statements in your program. | Default behavior |
ANIM | Adds extra information to the compiled object, for use by the Debugger. | -g compiler flag |
APOST | Causes the Compiler to interpret the | figurative constant QUOTE as the single- quote character ('). |
ARITHMETIC | Affects how arithmetic expressions are evaluated. | -fcompute-ibm -fno-compute-ibm compute-ibm:[yes/no] |
ASSIGN | Affects how to assign a filename when neither EXTERNAL nor DYNAMIC appear in the SELECT statement. | assign-clause: [cobol2002 / mf / ibm /external] |
AUTOLOCK | Sets the default locking to AUTOMATIC rather than EXCLUSIVE for files opened I-O or EXTEND in a multi-user environment. | autolock:yes |
BOUND | Enforces runtime-checking of subscript and index values, to make sure they are within the bounds described by the OCCURS clause. | -debug compiler flag |
CALLFH | Enables the EXTFH interface by causing all calls for I/O operations to be handled by the Callable File Handler. | -use-extfh compiler flag |
CALLSORT | Enables the EXTSM interface, allowing a named program to be called to handle all SORT and MERGE operations. | -use-extsm compiler flag |
CASE | Prevents external symbols (such as Program-ID and names of called programs) from conversion to upper case. | Default behavior |
CHARSET | Indicates the character set used by the environment. | ebcdic-charset: [yes/no] |
CHECK | Causes all run-time checks to be performed in generated code. | -debug compiler flag |
CHECKDIV | Indicates behavior for case where a program tries to divide by zero in a statement that has no exception handling. | div-check: yes default is yes |
COBFSTATCONV | Names the user-supplied module to be used by the Callable File Handler to convert the file status codes if an I/O error is encountered on a file. | -use-extfh compiler flag |
COBIDY | Location of the .idy file | -debugdb=<filename> compiler flag |
COMP5-BYTE-ORDER | Sets the byte ordering used for COMP-5 data. | comp5-byteorder: [native/big-endian] Default is comp5-byteorder: native. |
COMP-6 | Indicates if COMP-6 data is stored in binary or packed decimal format. | signed-comp6-as-comp3:[yes/no] |
CONSTANT | Creates a constant for use in the program. | constant "key=value" |
COPYEXT | Names the filename extension that the Compiler can use to identify a COPY file that is specified without an extension. | -ext=<extension> compiler flag |
COPYLIST | Causes the compiler to list the contents COPY files in a listing. | Default behavior |
COPYPATH | Provides a list of directories for the Compiler to search for copy files. | -I [path] compiler flag or COB_COPY_DIR or COBCPY environment variable |
DATACOMPRESS | Sets the level of data compression to be done on sequential and indexed files. | datacompress:[integer] or |
DATAMAP | Causes the compiler to produce a datamap in the listing. | "-t " compiler flag. By default, the datamap is included in the listing. |
DEFAULTBYTE | Causes unitialized data items in Working Storage to be initialized to a default byte. | defaultbyte:[any integer] Default is defaultbyte:0 Requires use-defaultbyte:yes compiler configuration flag also be set. |
DEFAULTCALLS | Sets the default calling convention. | Default is defaultcall:0 Designates default call-convention used when no CALL-CONVENTION is mentioned in a CALL statement |
DIALECT | Causes the compiler and runtime to behave in a manner consistent with the specified dialect. | -conf=<dialect.conf. |
EDITOR | Causes the compiler output error messages to a file in a format compatible with a specified editor. | -err <file> |
FASTCALL | Optimizes the speed of the CALL operation by not checking whether it is a main program. FASTCALL assumes that the target of a CALL operation is not a main program. EXIT PROGRAM will always cause an exit to the calling program. | -fcall-opt |
FCDREG | Causes the compiler todefine special registers giving access to File Control Descriptions (FCD) and Key Definition Blocks. | fcdreg:yes -ffcdreg |
FILESHARE | Changes the default locking to become AUTOMATIC instead of EXCLUSIVE for files in a multi-user environment. Automatically locks records on a WRITE or REWRITE statement when the program is locking multiple records. | share-all-autolock:yes |
FOLD-CALL-NAME | Folds the name of the target of the CALL, CANCEL, ENTRY, and CHAIN statements and the program-name in the PROGRAM-ID paragraph to upper or lower case. | runtime environment variable: COB_CALL_CASE=xul where x=exact, u=upper,l=lower |
FOLD-COPY-NAME | Folds the name of the target of the COPY statement to upper case or lower case. | -ffold-copy-lower compiler flag -ffold-copy-upper compiler flag |
FP-ROUNDING | Indicates whether one floating-point receiving item can affect the results of other, nonfloating-point receiving items. | -fround-fp compiler flag round-fp:[yes/no] Default is round-fp:no |
HOST- NUMCOMPARE | Affects the comparisons between integer numeric data items of USAGE DISPLAY and alphanumeric literals, figurative constants, or numeric operands. | -mfhostnumcompare compiler flag hostnumcompare: yes |
HOST-NUMMOVE | Prevents run-time error 163 (illegal characters in numeric fields) when certain MOVE statements are executed on numeric display data items or numeric operands. | move-picx-to-pic9:raw |
IBMCOMP | Indicates word-storage mode. | binary-size:2-4-8 |
IDENTIFIERLEN | Specifies the portion of an identifier name that the compiler will consider to be significant. | identifer-length: <max-length> |
INDD | Allows ACCEPT statements to be read from a specified file. | -sysin=<input file> compiler flag |
INITCALL | Names modules to be called immediately before the first statement of a program is executed. | -initcall=<program name> compiler flag initcall:<program-name> |
INITIAL | Determines how Working-Storage is initialized for programs marked as IS INITIAL. 1 indicated default behavior. 2 indicates the alternate method equivalent to initial-2. |
-finitial-2 initial-2[yes/no] Default is no |
INITPTR | Causes the INITIALIZE statement to initialize DATA-POINTER, OBJECT- REFERENCE, and PROGRAM-POINTER data types. | initialize-pointer[yes/no] Default is yes |
LIST | Name of the source listing file. | -t <filename> compiler flag |
LISTPATH | Gives the directory location for the list file to be written. The name of the list file is source-name.lst. | -t <directory> compiler flag |
LISTWIDTH, LW | Limits the width of the list file. | -ftruncate-listing compiler flag truncate-listing: yes |
`LNKALIGN | Causes level-01 and level-77 Linkage Section items to always be aligned on a machine-dependent favorable boundary. | -falign-8 compiler flag align-8: yes |
MAKESYN | Makes a reserved word synonymous with another reserved word. | -makesyn oldvalue=newvalue compiler flag makesyn: oldvalue=newvalue |
MFCOMMENT | Causes an asterisk (*) in column 1 to be treated as a comment line, but does not show the line in the source listing. | -fmfcomment compiler flag mfcomment: yes |
MOVE-LEN-CHECK | Causes source and target lengths for alphanumeric MOVE operations.to be checked by the compiler. | Default behavior |
OBJ | Causes an object file to be generated. | -o compiler flag |
ODOSLIDE | Causes the memory location of data items that are located after a variable length table to change as the length of the table changes. | -fodo-slide compiler flag odo-slide: yes |
OPT (Intel x86 platforms) | Set the optimization level of the code produced by the compiler on Intel x86 platforms. | -O compiler flag |
OPT (Non-Intel x86 platforms) | Set the optimization level of the code produced by the compiler on platforms other than the Intel x86 platforms. | -O compiler flag |
OPTIONAL-FILE | Causes the compiler to treat all files opened for I-O or EXTEND as optional. | -foptional-file compiler flag optional-file: yes |
OSEXT | Indicates what the file extensions are for COBOL source files. | Not required. COBOL program extension can be set in the Developer Studio, where the compiler needs to build only COBOL programs |
OUTDD | Causes the output of DISPLAY and EXHIBIT statements to be written to a specified file. | –sysout=<output file> [,S/L [,Min [,Max]]] compiler flag |
PANVALET | Allows ++INCLUDE statements in the source file. | supported by default |
PARAMCOUNTCHECK | Allows the program to be called with fewer parameters than are specified in USING clause. | -falloc-unused-linkage alloc-unused-linkage: yes |
PCOMP | Allows a user program to be named as a precompiler for COBOL files. | supported by default |
PERFORMOPT | Optimizes PERFORM operations. | -freturn-opt compiler flag return-opt: yes |
PERFORM-TYPE | Indicates behavior of return jumps from nested PERFORM statements. | perform-osvs: yes equivalent to PERFORM-TYPE (OSVS) PERFORM-TYPE(COB370) PERFORM-TYPE(ENTCOBOL) PEFORM-TYPE(VSC2) |
PREPROCESS, P | Causes the source file to be pre-compiled, and the output file to be compiled. | -preprocess compiler flag |
Names the source listing file. | -t <filename> compiler flag | |
PROFILE | Includes code in your program for purposes of generating performance statistics when the program is run. | -fprofiling compiler flag |
PROGID-COMMENT | Permits comments be included following the PROGRAM-ID header in the Program- Id paragraph. | default behavior |
QUAL | Permits qualified data-names and procedure-names in your program. | Qualified data-names are allowed in a program. |
QUOTE | Causes the Compiler to interpret the figurative constant QUOTE as the double- quote character ("). | quote: “ |
RECMODE | Describes the default format of files. | -frecmode-f compiler flag -frecmode-osvs compiler flag -frecmode-v compiler flag recmode-f: [yes/no] recmode-osvs: [yes/no] recmode-v: [yes/no] |
REENTRANT | Causes many program areas to be dynamically allocated, so that it is safe to have multiple copies of the program running. | -fthread-safe compiler flag thread-safe:yes |
REMOVE | Causes reserved words to be removed from the reserved word list, so that they can be used as user-defined words. | not-reserved [any reserved word ] |
RESEQ | Causes the compiler to produce line numbers in the listing file. | Developer Studio capability |
RTNCODE-SIZE | Sets the size of the RETURN-CODE register and its alignment in memory. | rtncode-size<integer> Integer may be 2,4,8 |
SEQUENTIAL | Indicates the default file type for files defined as ORGANIZATION SEQUENTIAL. | sequential-line:[yes/no] |
SETTING, SETTINGS | Causes the compiler to include a listing of directives, and their settings in the source listing. | -dump-config compiler flag default behavior |
SHOW-DIR | Causes the compiler show the contents of directives files in the source listing. | -dump-config compiler flag Default behavior |
SOURCEFORMAT | Selects format for COBOL source. | -free , -fixed compiler flags |
SOURCETABSTOP | Sets the rule for expanding tab characters encountered in the source code into spaces that is used by the compiler. | tab-width: [integer ] Default is 8 |
SPZERO | Causes space characters in USAGE DISPLAY numeric data items to be treated as zeros. | spzero: yes |
SSRANGE | Turns on runtime bounds checking for subscripting, reference modifications, and indexes. | -debug compiler flag |
STDERR | Causes compiler error messages to be written to STDERR. | -err <file> |
STICKY-LINKAGE | Affects how parameters passed to a program are handled during a runtime session in which the program is called multiple times. | sticky-linkage [yes/no/fixed/variable] |
TRACE | Turns on runtime tracing through READY TRACE and RESET TRACE statements. | -fsimple-trace -ftrace –ftraceall compiler flags |
TRUNC | Determines whether data being stored in USAGE COMP, USAGE BINARY or USAGE COMP-4 data items is truncated to the size given by the item's PICTURE clause or to the maximum size the item can hold. | -fnotrunc compiler flag |
UNICODE | Describes the encoding used for Unicode characters. | -futf16-le compiler flag utf16-le: [yes/no] default is utf16-le: no default is big-endian (portable). utf16-le is little-endian (native). |
USE | Causes the compiler to read directives from a file. | -conf=xxx.conf compiler flag -std=mf.conf compiler flag COBITOPT environment variable |
VERBOSE | Causes the compiler to be verbose. | -v compiler flag |
WARNING, WARNINGS | Specifies the lowest severity level of errors to report. | -w compiler flags |