What is COBOL used for?

26,556

Solution 1

COmmon Business Oriented Language 'invented' by Grace Murray Hopper ( read about her she is one one of the pivotal people in the development of computing as we know it today). The general idea was to produce a language that was English based as opposed to mathematically based or expressed as such in the code.

Very simply put you would use a construct like

ADD YEARS TO AGE

as opposed to

age = age + years

or

age += years

Appearing in the early 1960's it was massively adopted for processing in the area of business. There are still a large volume of applications built in COBOL still running and maintained and it is still very much alive and kicking. Around 1997 Gartner reported that 80% of the world's business ran on COBOL with over 200 billion lines of code in existence and with an estimated 5 billion lines of new code annually. So you could do a lot worse than learn COBOL to ensure you have a job for life.

The structure of a cobol program is summarised in the Mnemonic In Every Damn Program. Meaning that there is an:-

  • Identification Division giving information about the program
  • Environment Division describing the hardware
  • Data Division (In my day we used CODASYL now better known and newly re-invented as no-sql
  • Procedure Division 'Here be code'

Because of the legacy from punch cards (yes i used them as well) you always started the code by indenting 8 spaces in else some compilers would not recognise it (shades of Python where whitespace is significant).

It is of course a compiled language.

Where is it used. Governments, the Military Businesses of all sizes but usually the larger corporates so i suppose you could say everywhere and it is used to run governments, and the Military and business's. I believe the US's social welfare system runs on several million lines of Cobol written in the mid 60's. Experian a large UK based credit rating company uses it throughout there operation with interfaces to the web. Again in the UK most of the Building Societies and Banks run their core systems on it.

I could go on but i won't go and read about it. And by the way you can even get Object Oriented Cobol if you want

Solution 2

Ever use a credit card? Your transaction is probably touching COBOL code on the backend.

Solution 3

The Right Tool for the Right Job

Batch

The most salient point about COBOL is not its verboseness. It is that it was primarily designed, as a language, to do batch processing. Its I/O functionality in that regard is exceptionally efficient.

Even though it predates OOLs by a geological epoch, it is useful when speaking to a modern-day OO programmer to describe batch programming and COBOL from an OO point of view. Describing it like this, though historically incorrect, helps OO programmers conceptually.

To wit, the utterly fallacious, and yet very true:

COBOL has been "optimized" to iterate over large, nay, vast sequential "collections" (i.e. batches, also known as files). In fact, it is so optimized, that all the OO functionality has been stripped out, leaving a basic API that opens files, processes records, and closes files. In more complex version of the basic algorithm, multiple files are opened, their records matched to each other and manipulated to produce one or more output files (batches).

Where COBOL was co-opted for non-batch processes, for instance pseudo-conversational programming (backing up CICS "green" screens - aka BMS), it was least suitable. Not surprisingly, it is this functionality that has been most quickly replaced by GUI apps written in OOLs.

The Editor

The ISPF Editor on IBM mainframes has been optimized to handle the kind of coding COBOL requires. The basic unit of manipulation in the editor is the line. By default, vertical alignment is static and not flowed or shifted based on context; typing to the end of a line results in a keyboard lock. Because of this "conservation of vertical alignment," it is relatively easy to duplicate lines or blocks of lines, and align commands. With COBOL vertical alignment, as a legibility issue, is of greater importance than OO languages.

It is difficult to describe in a post, but having facility in both programming worlds and with both types of editors, I have to say that I would not want to edit COBOL in an IDE style editor, and I would not want to edit Java and C-family languages in an ISPF Editor. (I imagine you can plug-in an ISPF style editor into the various IDEs, but I haven't had the need to go there.)

N.B. OO COBOL has its uses, but not as a new way to re-engineer code that handles batch processing.

Solution 4

From my, although limited experience, COBOL is used a lot with IBM mainframe systems. So I believe in any situation where I/O is the emphasis (as mentioned above financial systems, insurance companies, government, etc) to the extent that a mainframe is needed or preferred and has been around for a while COBOL is probably used. I say been around for a while since in modern day I do not hear much of COBOL being a go to language.

Share:
26,556
Charu
Author by

Charu

Updated on July 09, 2022

Comments

  • Charu
    Charu almost 2 years

    What is COBOL used for?

  • user207421
    user207421 over 13 years
    First Cobol standard was Cobol-60. Work was going on since 1959 formally, and it drew on prior art. It wasn't 'invented' by Admiral Hopper: she ran the project.
  • PurplePilot
    PurplePilot over 13 years
    I think it drew heavily on FLOW-MATIC and i put the invented in inverted commas to sort of indicate that Grace didn't really invent it. It was of course put together by a committee much in the same way as we still do. There is nothing really original and of course COBOL grew out of work that had been done before in one form or another. On a minor note to all her other achievement Grace was the last US Navy officer who had served in WW2 to retire from the navy.
  • DuncanKinnear
    DuncanKinnear over 11 years
    According to this article from a couple of years ago (which has good citations of the facts it presents) "There are around 200 billion lines of COBOL code in use" and "Around 5 billion lines of new COBOL code are added to live systems every year". Yup, sounds pretty dead to me! ;-)
  • NealB
    NealB almost 11 years
    COBOL - a glorified assembler macro language? I don't think so... Just because a compiler can produce an assembler list does not make it an assembler macro processor. Some of the other blanket statements regarding how various languages are used seems to be a little dogmatic as well.
  • Joe Zitzelberger
    Joe Zitzelberger over 10 years
    A wildly inaccurate group of statements. Cobol is still used because it works well in the business domain, it has nothing to do with rewriting and everything to do with being a good fit. The 72-char line length is just silly ignorance, format free source is support by all the current compiler vendors and AFAIK, most of the free ones, going back decades. Cobol is as useful as any other general purpose language and it is truly impossible for a language to be evil...except Basic...
  • RFlack
    RFlack over 10 years
    Another nit to pick, punched cards were actually 80 columns but 8 were used for sequencing (if you've ever dropped a tray if cards you'll understand) leaving 72, in the early days that is.
  • Rolf of Saxony
    Rolf of Saxony over 6 years
    Plus 1 just for the statement Procedure Division 'Here be code' A blast from the past, twenty something years of fighting c.o.b.o.l. dragons