COBOL

COBOL is one of the oldest programming languages and has been pronounced dead many times.

The abbreviation stands for COmmon Business Oriented Language and was primarily developed for finance, business and administration.

Still running in many banks, processing financial transactions in the background every day all over the world, I decided to teach myself some COBOL.

Yes, I know: It is not sexy, but it will pay and it is actually fun learning something pretty different from modern programming languages.

In COBOL you can implement loops using either GO TO or PERFORM.

Since jump marks like GO TO  are notorious and considered bad coding practice, I will focus on PERFORM in this article.

Just be aware that you will find programmers using GO TO and yes, I do blame them for that no matter which programming language or how experienced they are.

GO TO should be abolished!

PERFORM

Let's have a look at a very basic Hello World example written in COBOL compatible with older versions of COBOL compilers. 

1
2
3
4
5
6
7
8
9
10
11
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. HELLO.
000300 ENVIRONMENT DIVISION.
000400 DATA DIVISION.
000500 PROCEDURE DIVISION.
000600
000700 PROGRAM-BEGIN.
000800     DISPLAY "Hello world".
000900
001000 PROGRAM-DONE.
001100     STOP RUN.

 Building blocks of a COBOL program