| iMatix home page
| Libero home page | Libero documentation
| << | < | > | >>
Libero Libero
Version 2.32

 

The COBOL Language

Overview

What Is COBOL?
COBOL is a standard language for business software, a job that it does well. It is heavily used in the mainframe world. COBOL has an undeserved reputation for inefficiency, and a deserved reputation for verbosity. Today, many COBOL applications are being moved from mainframes to UNIX boxes.
Portability
Deaf, dumb, blind COBOL programs can be very portable. Otherwise you can use external libraries to achieve 100% portability (catch: you may have to write these libraries yourself).
Pros and Cons
Pros: easy to use and teach. An excellent language for mediocre developers, which includes me at least two days of the week. Cons: Tends to encourage large, monolithic programs. Like unreadable C code, this is a question of discipline. COBOL provides no way to define data types directly, and has a verbose and over-rich syntax. COBOL compilers are often unimpressive. This is actually putting it mildly: on several systems that I've worked on, a simple loop in COBOL runs from 100 to 1000 times slower than the same loop coded in assembler. I've seen just one COBOL compiler (Versions 2 and 3 of Realia) that could produce truly excellent code.
How To Get It
No free implementations exist, despite various attempts -- including one by me: if a COBOL compiler is Mt. Everest, I got as far as London Heathrow airport. You need to find a commercial COBOL vendor for your system.
Libero Supports
ANSI 74 COBOL and ANSI 85 COBOL.

Working With COBOL

Example of code

Code fragments:

*****************   MODULE FUNCTION NAME   *****************

 MODULE-FUNCTION-NAME.
     EXIT
     .

 PRIVATE-FUNCTION-NAME.
     MOVE OK-EVENT TO THE-NEXT-EVENT

     MOVE ERROR-EVENT TO THE-EXCEPTION-EVENT
     MOVE    "YES"    TO EXCEPTION-RAISED
     .

A fuller example.

Notes

COBOL has a reputation for encouraging large unwieldy programs. This is justified to the extent that the language is verbose. I think it's more due to the fact that COBOL programs tend to be written and maintained under particular pressures: get it working, now, and who cares if it is a little unwieldy. You don't often see COBOL code competing on the open market for software where program size and speed are important.

People working in COBOL expect monsters, so often get them. Now, I've spent a lot of my life writing COBOL - perhaps half a million lines or so, and I know that this unnecessary suffering. Of course it is possible to write clean, organised, commented code without Libero. It is just a lot more effort, and I'm lazy.

This schema is for batch programs and subroutines. Batch programs are often the largest and most complex COBOL programs, and often benefit from a dialog. I've not seen a lot of subroutines that really needed a a dialog; the expression calculator is one example. Also, if you split a large batch program into smaller subroutines, these can be complex enough to warrant a dialog. Very roughly, I would reckon that a COBOL program of more than 1000 lines is worth building around a dialog.

Specific Schema Options


| << | < | > | >>
| Libero's Languages | The Awk Language | The C Language | The C++ Language | The COBOL Language | The GNU Borne-Again Shell Language | The Java Language | The Microsoft Setup Basic Language | The MS Visual Basic Language | The Perl Language | The Rexx Language | The UNIX C Shell Language | The UNIX Bourne Shell Language | The UNIX Korn Shell Language | The 80x86 Assembler Language
iMatix
Copyright © 1996-97 iMatix