An Intro to COBOL Programming Language

After coming so close to finishing the Mainframe IBM badge, I have been furiously studying COBOL over the past week and I thought it would be great to summarise my understanding of this mature programming language so far.

Common Business Oriented Language (COBOL) is a procedural programming language which dates far back as 1959. It was initially designed by the US Department of Defence to standardise a common programming language amongst manufacturers’ computers. Its primary use was to perform accounting and commercial tasks and at one point, it was the most widely-used programming language in the World.

If you imagine life back in the 1960’s where computers were a new thing, programs were written at that time using punch cards and magnetic tape for any input and output of data….one of them definitely being COBOL.

COBOL punch card, Rainer Gerhards, CC BY-SA 3.0
Source: https://opensource.com/article/17/8/what-about-cobol

The COBOL compilers required that the code is placed into specific column ranges as shown on the punch card. For example, column 1-6 contained sequence numbers 00001, column 7 would contain an asterix * which was used for comments and column 8-72 contained the actual program statement and so on. Since punch cards then became a thing of the past, the same outlay was transferred on to the terminal screen.

More about COBOL

COBOL is a programming language quite different to programming languages that I have previously studied i.e. Java, JavaScript, Python etc. The most noticeable and useful feature is that it uses the English language. It uses the English structure such as verbs, clauses and sentences in order to made it easily understood.

COBOL uses its form like a sentence and paragraph structure. Each statement is made of a verb and operand, for example:

 Add 1 to WS-A
Open Input FILE-IN
Exit

Furthermore, A COBOL program is made up of divisions…and (again) it works somewhat similar to the English language:

In addition there are four divisions in the structure of COBOL which are:

  • Identification Division – where program information is specified.
  • Environment Division – environment where the program will run (files accessed, symbolic characters used etc).
  • Data Division – information about the data such as tables used, layout, working storage variables.
  • Procedure Division – code required to process data and perform an output.

As with most programming languages, COBOL has certain syntax rules that were to be adhered to. For example, names cannot start and end with a hyphen or underscore and the maximum length of characters per name is 30.

You can see a sample below of COBOL code and how it compares to the English language (pretty simple isn’t it?)

   Identification Division.
   Program-ID. SAMPLE. 
   Environment Division.
  * Not used in this program.

   Data Division.
  * Not used in this program.

   Procedure Division.
   Procedure-1.
       Display 'Hello World'
   Stop Run

During my studies, there is a lot more to COBOL then what has been described in this post but hopefully, potential programmers may want to explore COBOL since it is still used in a lot of the businesses today and is easier to learn.

Why you should learn COBOL?

  • COBOL is versatile in that it can be run on almost every hardware platform.
  • Learning COBOL is easy as it is made up of English-structured components.
  • The financial sector is underpineed by COBOL systmes due to its efficient numeric processing functions.
  • COBOL is easy to read and maintain due to its hierarchical structure.
  • COBOL works with everything including web, cloud and mobile!
  • Further examples: https://blog.microfocus.com/2232/

To finish off, I thought I would add some facts about COBOL based on the IBM badge that I am studying. This is through my University which has links with Interskill so if you are interested in pursuing an IBM badge, please contact your local institution.

Did you know that:

  • 70 % of all critical business systems use COBOL
  • 90% of Fortune 500 Companies use COBOL
  • 85% of all daily business transactions are processed by COBOL programs
  • 95% of all ATM transactions are processed by COBOL programs

To learn more about COBOL

#COBOL #Cobol #Mainframes #Mainframe #programming #coding #IBM #

Leave a comment