What is COBOL?
Background:
In the late 1950 s, computer users and manufacturers were becoming
concerned about the rising cost of programming. A 1959 survey had found that in
any data processing installation, programming cost at least $800,000 and that
translating programs to run on new hardware would cost $600,000. At a time when
new programming languages were proliferating at an ever increasing rate, the
same survey suggested that if a common business-oriented language were used,
conversion would be far cheaper and faster.
Introduction:
COBOL is a high-level programming language first developed by
the CODASYL Committee (Conference on Data Systems Languages) in 1960. Since
then, responsibility for developing new COBOL standards has been assumed by the
American
National Standards Institute (ANSI).
Three ANSI standards for COBOL have been produced: in 1968,
1974 and 1985. A new COBOL standard introducing object-oriented programming to
COBOL, is due within the next few years.
The word COBOL is an acronym that stands for Common Business
Oriented Language. As the expanded acronym
indicates, COBOL is designed for developing business, typically file-oriented,
applications. It is not designed for writing systems programs. For
instance you would not develop an operating system or a compiler using COBOL.
How widely used is COBOL?
For over four decades COBOL has been the dominant programming
language in the business computing domain. In that time it has seen off the
challenges of a number of other languages such as PL1, Algol68, Pascal,
Modula, Ada , C, C++. Two recent challengers though, Java and Visual Basic,
are proving to be serious contenders.
Surprised by COBOL's success?
People are often surprised when presented with the evidence
for COBOL's dominance in the market place. The hype that surrounds some
computer languages would persuade you to believe that most of the production
business applications in the world are written in Java, C, C++ or Visual
Basic and that only a small percentage are written in COBOL. In fact, the
reverse is actually the case.
One reason for this misconception lies in the difference
between the vertical and the horizontal software markets.
Ø
Vertical software:
In the vertical software market (sometimes
called "bespoke" software) applications cost many millions
of dollars to produce, are tailored to a specified company, encapsulate the
business rules of that company, and only a limited number of copies of the
software may be in use.
Ø
Horizontal software:
In the horizontal software market, applications may still
cost millions of dollars to produce but thousands and these applications often
have a very high profile, a short life span, and a relatively low per-copy
replacement cost. The Microsoft Office suite (Word,
Excel, and Access) is an example of an application in the horizontal
software market. Because of the highly competitive nature of this marketplace
considerations of speed, size and efficiency often make languages like C or C++
the language of choice for creating these applications.
COBOL is simple
COBOL is a simple language (no pointers, no user defined
functions, no user defined types) with a limited scope of function. It
encourages a simple straightforward programming style. Curiously enough though,
despite its limitations, COBOL has proven itself to be well suited to its
targeted problem domain (business computing). Most COBOL programs operate in a
domain where the program complexity lies in the business rules that have to be
encoded rather than in the sophistication of the data structures or algorithms
required.
Advantages of COBOL:
We noted above that COBOL is a simple language with a limited
scope of function. And that is the way it used to be but the introduction of
OO-COBOL has changed all that. OO-COBOL retains all the advantages of previous
versions but now includes -
o User
Defined Functions
o Object
Orientation
o National
Characters - Unicode
o Multiple
Currency Symbols
o Cultural
Adaptability (Locales)
o Dynamic
Memory Allocation (pointers)
o Data
Validation Using New VALIDATE Verb
o Binary and
Floating Point Data Types
o User
Defined Data Types
Readers who are familiar with C or C++ or Java might want to
consider how difficult it becomes to maintain programs written in these
languages. C programs that you have written yourself are difficult enough to
understand when you come back to them six months later. Consider how much more
difficult it would be to understand a program that had been written fifteen
years previously
Simple program in COBOL:
We want to write a
program which will accept two numbers from the user’s keyboard, multiply them
together and display the result on the computer screen.
Any program consists of three main things;
A plan, or algorithm, that arranges the computer statements
in the program so that the computer executes them in the correct order.
Program Statements and Data items
We will need a statement to take in the first number and
store it in the named memory location (a variable) - Num1
ACCEPT Num1.
We will need a statement to take in the second number and
store it in the named memory location - Num2
ACCEPT Num2.
We will need a statement to multiply the two numbers together
and to store the result in the named location - Result
MULTIPLY Num1 BY
Num2 GIVING Result.
We will need a statement to display the value in the named
memory location "Result" on the computer screen -
DISPLAY
"Result is = ", Result.
Some notes on syntax diagram:
To simplify the syntax diagrams and reduce the number of
rules that must be explained, in some diagrams special operand endings have
been used (note that this is my own extension - it is not standard COBOL).
These special operand endings have the following meanings:
ü $i uses an alphanumeric data-item
ü $il uses an alphanumeric data-item or a
string literal
ü #i uses a numeric data-item
ü #il uses a numeric data-item or numeric
literal
ü $#i uses a numeric or an alphanumeric
data-item
What we normally understand as data processing is of course
to calculate or compute (hence "computer"), and COBOL naturally also
offers several possibilities:
·
ADD
·
SUBTRACT
·
MULTIPLY
·
DIVIDE
·
COMPUTE
Top 10 Reasons to Learn COBOL
1. COBOL is easy!
Learning COBOL isn’t like learning a completely new language:
it’s English! It consists of English-like structural components such as verbs,
clauses and sentences. Its readability means that you can understand what a
program is doing without having to learn a whole new syntax.
2. You can run it anywhere you like
COBOL has been ported to virtually every hardware platform.
Programs written in this “write once, run anywhere” language enables businesses
to reuse COBOL applications that were written decades ago on new platforms
like. COBOL has been able to adapt to change: each new enterprise platform
which emerges has had COBOL applications deployed there.
3. It will work tomorrow as well as it does today
Businesses already using COBOL are likely to continue to use
COBOL rather than replace it. Replacing COBOL would be expensive – due to its
enormous scale, time-consuming and risky, as well as being completely unnecessary.
4. It gets the numbers right!
It is no surprise that the financial sector is underpinned by
COBOL systems: banking, insurance, fund management, pension systems, payroll
and credit cards, all depend on COBOL. COBOL’s numeric processing functions
make it the perfect choice for applications.
5. You can use it with your favorite IDE
There’s no need to worry about learning a new toolset. You
can develop COBOL applications using Visual Studio or Eclipse. These IDEs bring
all the great productivity aids you use today
6. You can get to your data fast
Whilst COBOL can process data from a variety of sources
including just about any Relational Database Management System (RDBMS), it also
provides direct language support for data files, outperforming database
processing by miles. COBOL systems use indexed data files which maintain
internal B-tree structures (meaning that speed and efficiency are two important
features), providing rapid access to data even when data stores run into
terabytes.
7. You don’t need to spend hours on documentation
COBOL is self-documenting. The readability of COBOL code and
its rigid hierarchical structure make COBOL easy to read and maintain. When was
the last time you read a comment, found that it had no relation to the code and
spent the next half an hour trying to make sense of the code and the comment?
This happens all too frequently as a result of general application maintenance.
Code changes but comments are sometimes forgotten.
8. Its fast!
COBOL has 50 years of optimizations under its belt, so it
knows what it’s doing when it comes to data processing. Micro Focus’s COBOL
“code generator” uses target platform technology to deliver maximum
performance, as well as enabling the creation of fully portable and executable
code.
But it’s not just the generator that maximizes performance.
Most COBOL code is also procedural, not object-oriented, so its old-school
straight line performance can give it a real edge over other languages.
9. It integrates with everything
COBOL systems have retained business value by integrating
with new technology. For example, COBOL programs can be called by most other
computer languages, deployed in Java application servers, provide backend
Service-oriented Architecture (SOA) logic, work with Unicode strings. By
combining your new found COBOL skills with systems you know today, you can
enhance existing COBOL applications in the web, mobile and Cloud.
10. COBOL is everywhere!
We are surrounded by COBOL: it runs over 70% of the world’s
business transactions.” The vast majority of us will use COBOL in one form or
another as part of our daily existence.” As senior programmers retire, they
must be replaced with a new generation of COBOL programmers, or the business
world is likely to collapse completely. It makes sense to replenish the supply
of COBOL programmers by training new ones.
Learning COBOL could therefore make you highly desirable.
Kanwal