October 1999
Beginner
410 pages
10h 45m
English
COBOL is an acronym for Common Business Oriented Language and was developed in the late 1950s by Grace Hopper for the purpose of writing business-related programs, which she felt should be written in English. However, it seems rather that the language was developed with the express purpose of avoiding all mathematical-like notation, with the inevitable consequence that conciseness and readability is also avoided.
At any rate, I could only bring myself to code a COBOL sample program that adds two numbers:
* COBOL PROGRAM TO ADD TWO NUMBERS IDENTIFICATION DIVISION. PROGRAM-ID.ADD02. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 FIRST-NUMBERPIC IS 99. 01 SECOND-NUMBERPIC IS 99. 01 SUM PIC IS 999. PROCEDURE DIVISION. PROGRAM-BEGIN. DISPLAY "ENTER FIRST NUMBER ". ACCEPT FIRST-NUMBER. DISPLAY "ENTER SECOND NUMBER ". ACCEPT SECOND-NUMBER. COMPUTE SUM = FIRST-NUMBER + SECOND-NUMBER DISPLAY "THE SUM IS: " SUM. PROGRAM-DONE. STOP RUN.
In BASIC, the preceding program would be:
INPUT "Enter first number: ", n1 INPUT "Enter second number: ", n2 PRINT "The sum is: ", n1 + n2
This clearly points out the extreme verbosity of COBOL.
Read now
Unlock full access