There are at least 4 independently written major modes that handle COBOL source files.

The most recent cobol-mode is now available on ELPA and is the most up-to-date and featureful of the available cobol-modes. (It also available at here.) It has:

Both the cobol-mode here and the nmcobol-mode here are fairly new [circa 2005] and still a work-in-progress. The first is for ANSI Cobol while the second is for TANDEM Cobol. See TandemNskSupport for other TANDEM specific modes.

I'm writing these because I didn’t like the only other Cobol mode I could find. I’m not a COBOL programmer but can/must maintain such programs periodically. I believe comments and strings are being handled correctly and keyword highlighting is starting to take shape. Both versions are being developed for Tandem/Guardian/NSK source files. That is, for use with Scobol and Tandem Cobol so these modes should handle the extensions implemented by those compilers. They may fail to correctly handle features not implemented by those compilers. Help appreciated.

For ?ANSI format: Lisp:cobol-mode.el

For ?TANDEM format: Lisp:nmcobol-mode.el

To install, put the .el file into a directory in your LoadPath and add the appropriate lines to your ~/.emacs file:

    (autoload 'cobol-mode "cobol-mode" "A major mode for editing ANSI Cobol/Scobol files." t nil)
    (autoload 'NMCobol-mode "nmcobol-mode" "A major mode for editing Tandem format Cobol files." t nil)

When you are visiting a Cobol or Scobol source file you can use ‘M-x cobol-mode’ or ‘M-x nmcobol-mode’ to activate the appropriate mode.

For best performance you should byte compile .el files but it’s not required. A CompiledFile usually runs faster. There should be no warnings when compiling either file.

See the TandemNskSupport page for a method of automatically recognizing the language of Tandem files since they don’t have an extension and coders often can’t stick a -*-cobol-*- comment in line 1.

Another cobol-mode (aka clomo).

You can find it on the Azundris site but I don’t think it’s a good idea to put a link to it here. It has a malicious bug that deletes periods and commas somewhat randomly from your source. I reported it and since it wasn’t fixed I worry that it is intentionally malicious.

You can fix the bug by changing the syntax properties of period and comma in the mode’s syntax table. You may also need to comment out the line (font-lock-unset-defaults) to make it work under GNU Emacs 22.0.50. It doesn’t have anything close to my version’s handling of comments and strings but it does do a great many things that my new one doesn’t. After fixing it’s syntax table a given individual may decide either is the lesser of two evils.

There is another cobol.el from the (apparently defunct) *COBOL for GCC* project. See here. It includes syntax highlighting. It is based on a cobol.el dated June 21, 1988, which is itself based on a FORTRAN mode for Emacs.

Unfortunately this link seems to be broken (2006-12-26) and I’m unable to locate any archive copies. Perhaps such things should be dumped into the gnu.emacs.sources newsgroup so Google will archive them for all eternity.