|3. Everything / Languages & Linguistics / Languages / Computer Languages|
3. Everything / Maths, Science & Technology / Computers / Computer Languages and Programming
COBOL, Common Business Oriented Language, was developed in 1960 by a joint committee to meet the needs of the commercial world that other languages of that time, Fortran or Assembler, for instance, failed to do.
Contrary to popular belief, COBOL is not extinct today as one might guess, but it has a very outdated flavour due to the fact that its main use is on mainframes. Therefore, programming in COBOL or even knowing COBOL cannot be publicly admitted without the risk of being ridiculed.
Let's compare COBOL with a popular, more modern programming language like C. A fictional small C program that would look like this,
Shoot yourself in the foot.
would look like this when programmed in COBOL:
USING A COLT-45-HANDGUN,
AIM GUN AT FOOT OF LEG, THEN
PLACE FINGER OF HAND OF ARM ON
TRIGGER OF HANDGUN AND SQUEEZE
THEN RETURN HANDGUN TO HOLSTER
CHECK WHETHER SHOELACE NEEDS TO BE RETIED.
The current standard is COBOL-85, often referred to as COBOL-2. The previous one was COBOL-74, which has just recently been replaced on older mainframes because of Y2K issues. The next standard COBOL-0x is currently in revision by the respective ANSI and ISO committees. The main issue of the revision is reportedly the inclusion of Object Oriented concepts.
A lot of COBOL programs are contaminated with hundreds of GOTOs. This is largely due to the fact that these programs (and their creators) are following the older COBOL-74 standard which lacked many of the control structures needed to avoid them. Progress is very slow within the COBOL community.
COBOL programs have line numbers, like earlier versions of BASIC. In fact, a COBOL program usually has to be coded in a fixed format that derives from punch cards, which allows only 80 characters per line. Only a given area could be used for 'real code' (position 12 to 72), the rest is used for line numbers, indicators and comments.
COBOL is a rather verbose programming language, as seen in the example given at the top of this entry. It was initially designed for business applications, and the similarity with the English language was implemented deliberately for easier learning by non-IT personnel. There are a lot of filler words that aren't necessary and could just as well have been left out.
It isn't necessary to capitalise everything in a COBOL program (at least on PC and UNIX platforms) but many programmers do so in commemoration of the good old days of mainframe programming where lower case letters were automatically converted to upper case ones.
For business applications on mainframes, COBOL is still the language of choice in most cases. However, much of program development/debugging/testing is done on a PC nowadays; the source code is then transferred to the mainframe where it is compiled and the program is executed. Most vendors of COBOL development environments for the PC thus support cross-platform development by offering emulators for the mainframe environment.
In the public mind, the millennium bug is often synonymous with old COBOL programs (often referred to as 'legacy code') running on outdated mainframes that incompetent IT management failed to replace with modern technology. What is true, however, is that most COBOL programs originally stored dates with just two digits for the year, which is why billions of lines of code had to be revised worldwide to avert the big disaster on New Year's Day 2000.
Programming on a mainframe - On mainframes, COBOL is the standard programming environment, and is typically very well integrated into the infrastructure of systems such as databases, transaction systems, etc.
Processing large amounts of data - Processing without much user interference is one thing mainframes are specifically designed and optimised for. Think of generating and printing 100,000 and more invoices, payslips or suchlike out of a multi-gigabyte database within two hours.
Database handling - COBOL has built-in routines for handling indexed files that are the same on every system they might be used on. In most other programming environments you have to fall back upon external routines and libraries for database handling which are not necessarily available for every possible machine or operating system.
Generating print output - Using COBOL to insert decimal points, currency signs and replace leading zeroes (for example) is easy and effective.
Multiple platform development - Due to the quite restrictive standards regarding the compiler core as well as runtime environment, COBOL programs can be ported reasonably well to other platforms. There are, however, machine-dependent data formats which could make the migration of existing data a bit more difficult.
... you aren't in a situation mentioned above, for example, if you want a graphical front end. Although most COBOL compilers have toolkits for generating graphical user interfaces, these are far better created with other programming environments. Also, more low-level applications like file compression tools, for instance, are surely not meant to be programmed in COBOL, and will be dramatically slower than the same application written in C.
Discuss this Entry
People have been talking about this Guide Entry. Here are the most recent Conversations:
COBOL and line numbers
(Last Posting: Jan 30, 2003)
"Shoot yourself in the foot."
(Last Posting: Jan 27, 2003)
(Last Posting: Jun 6, 2002)
(Last Posting: Nov 6, 2001)
Please note that Not Panicking Ltd is not responsible for the content of any external sites listed.