The main program and subprograms can be compiled separately.
The main program is compiled as usual:
$ cobc -o main main.cob
Subprograms are compiled with the option -m
:
$ cobc -m subr.cobThis creates a module file
subr.so
1.
Before running the main program, install the module files in your library directory:
$ cp subr.so /your/cobol/lib
Now, set the environment variable COB_LIBRARY_PATH
to your library directory, and run the main program:
$ export COB_LIBRARY_PATH=/your/cobol/lib $ ./main