Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

Introductory examples

Compiling and linking with the cobol command

cobol -M BSPPROG hugo.cob

compiles hugo.cob and generates an executable named a.out.
The program with the PROGRAM-ID name BSPPROG becomes the main program


cobol -o hugo -M BSPPROG hugo.cob

compiles hugo.cob and generates an executable named hugo.
The program with the PROGRAM-ID name BSPPROG becomes the main program


cobol -c -P "(SOURCE,DIAG)" hugo.cob upro.cob

compiles hugo.cob and upro.cob and generates the object files hugo.o and upro.o and a source and diagnostic listing for each compilation unit. The listings are stored in the listing files hugo.lst and upro.lst respectively.


cobol -M BSPPROG -o hugo hugo.o upro.o

links the main program hugo.o and the module upro.o into an executable named hugo.The program with the PROGRAM-ID name BSPPROG becomes the main program