Trust is earned, not given

A different perspective

2017-05-20 · Projects

COBOL, FORTRAN and dBASE/FoxBase: three languages that built computing

Long before Python tutorials and JavaScript frameworks, three languages ran the world's real work: COBOL processed the paychecks, FORTRAN calculated the missiles and the weather, and dBASE/FoxBase put a database on every small business desk. This article is a guided tour β€” where each came from, what the code actually looked like, why they lost their crowns, and why two of them never really left.

COBOL (1959): the language written by committee β€” on purpose

By 1959 every computer maker had its own language, and the U.S. Department of Defense was tired of rewriting payroll for each machine. The result was COBOL β€” COmmon Business-Oriented Language β€” designed by a committee that included Grace Hopper's FLOW-MATIC ideas, with one radical constraint: managers and clerks should be able to read it. Hence the famously verbose English syntax.

       IDENTIFICATION DIVISION.
      *-- PAYROLL-ADDON: give every clerk earning under 30000 a 5% raise --*
       PROGRAM-ID. PAYROLL-ADDON.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  WS-EMPLOYEE.
           05  WS-NAME          PIC X(20).     * 20-character name field
           05  WS-SALARY        PIC 9(7)V99.   * 7 digits, 2 implied decimals
           05  WS-TITLE         PIC X(10).
       01  WS-NEW-SALARY        PIC 9(7)V99.
       01  WS-EOF               PIC X VALUE 'N'.

       PROCEDURE DIVISION.
       MAIN-PARA.
           PERFORM UNTIL WS-EOF = 'Y'
               READ EMPLOYEE-FILE              * get the next record
                   AT END MOVE 'Y' TO WS-EOF   * no more records: flag it
                   NOT AT END
                       IF WS-TITLE = 'CLERK' AND WS-SALARY < 30000
                           COMPUTE WS-NEW-SALARY ROUNDED =
                                   WS-SALARY * 1.05   * the actual raise
                           DISPLAY WS-NAME ' now earns ' WS-NEW-SALARY
                       END-IF
               END-READ
           END-PERFORM
           STOP RUN.

How it works: COBOL programs are divided into rigid DIVISIONs. The DATA DIVISION is the language's real innovation: you describe record layouts (PIC 9(7)V99 means seven digits with an implied decimal point and two decimals) that map byte for byte onto punch cards and magnetic tape. Arithmetic is decimal, exactly like accounting, so money never suffers binary rounding errors. That single design decision is a large part of why banks still trust it.

How it got replaced (mostly): it didn't, really. Java and C# took the new server applications, but the core systems β€” banking ledgers, insurance, government batch runs β€” were too big, too correct, and too regulated to rewrite; migration attempts in the 1990s became famous disasters. Decades of predictions of COBOL's death keep failing: every few years a government system breaks and the news rediscovers the language β€” and the recruiters hunting COBOL programmers.

FORTRAN (1957): the language that proved compilers could work

FORTRAN β€” FORmula TRANslation β€” came first, at IBM, where John Backus bet his career that a program could translate mathematics into machine code as efficiently as a hand-tuned human. Skeptics said automatic compilation could never compete with assembly written by hand. The 1957 release changed their minds: on typical numeric problems its output was within striking distance of hand-crafted code, and the economics of programming changed overnight.

      PROGRAM TEMPS
C     ----------------------------------------------------------
C     Find the hottest day in a week of Fahrenheit readings.
C     A C in column 1 makes the line a comment.
C     ----------------------------------------------------------
      REAL TEMP(7)
      INTEGER I, HOTDAY
      REAL HOTTEST

      DATA TEMP / 61.5, 63.0, 59.8, 71.2, 78.4, 82.1, 77.9 /

      HOTTEST = TEMP(1)          ! start by assuming day 1 is hottest
      HOTDAY  = 1

      DO 10 I = 2, 7             ! old-style counted loop, label 10
         IF (TEMP(I) .GT. HOTTEST) THEN    ! .GT. means "greater than"
            HOTTEST = TEMP(I)    ! new maximum found
            HOTDAY  = I          ! remember which day it was
         ENDIF
   10 CONTINUE                   ! loop jumps back to this label

      PRINT *, 'Hottest day was number', HOTDAY,
     $         'at', HOTTEST, 'degrees F'   ! $ in col 6 = continuation
      END

How it works: FORTRAN was born in the punch-card world β€” one card per line, 80 columns. Columns 1-5 held statement labels and column 6 held continuation markers, which is why the listing above looks the way it does. .GT., .LT., .EQ. existed because > and = were not on card-punch keyboards. Arrays start at 1, because mathematicians wrote the spec. Everything about the language is optimized around one goal: making array mathematics fast. That focus is why FORTRAN still beats general-purpose languages on supercomputers β€” modern variants run climate models and computational fluid dynamics today.

How it got replaced: in business computing it never belonged β€” COBOL took that territory. In scientific computing, C (1972) chipped away as a general-purpose language that was also good at systems work, then C++ and Python-with-C-libraries took the application layer. But the numerical cores β€” linear algebra libraries, weather models, orbital mechanics β€” never left. New FORTRAN is still written when performance is the point.

dBASE and FoxBase (1980s): the database that fit on a floppy

COBOL and FORTRAN lived on mainframes. The microcomputer revolution needed something a small business could afford. Ashton-Tate's dBASE II (1980) put a database, a programming language, and a form/report generator in one box that ran on a CP/M or DOS PC. The language (stored in .PRG command files) was so natural for data work that competitors cloned it β€” and Fox Software's FoxBase, later FoxPro, was the fastest and best of the clones. Microsoft eventually bought Fox Software and retired the product: it competed too well with Access and SQL Server.

*--  CLUB.PRG: list members with unpaid dues, FoxBase/dBASE III style  --*
USE CLUB                                 * open CLUB.DBF, the member table

LOCATE FOR DUEAMT > 0 .AND. .NOT. PAID   * find the first matching record
DO WHILE .NOT. EOF()                     * loop while a match was found
    ? TRIM(FIRST) + ' ' + LAST           * ? prints on a new line
    ?? '  owes $' + STR(DUEAMT, 6, 2)    * ?? appends at the same position
    SKIP                                 * advance one record
    CONTINUE                             * ...then the next *matching* record
ENDDO

USE                                      * close the table

How it works: the genius was that the language was the interactive prompt. At the dot prompt you could type USE CLUB and then LIST FOR DUEAMT>0 and get answers immediately β€” no program needed. The .DBF file was a fixed-record table with a byte-level format simple enough that every tool could read it, with .NDX/.NTX files as B-tree indexes. SEEK on an index found a record in a handful of disk reads; SET FILTER made every subsequent command pretend the table held only the matching rows. The syntax's DNA is still visible: Harbour/Clipper keep xBase alive as a compiled language, and the dot-prompt's instant-query feel is exactly what modern data notebooks are trying to recreate.

How it got replaced: by GUIs and client-server. The 1990s wanted Windows front ends, where Visual Basic with data controls and Access with forms won the desktop; network-scale systems moved data behind real SQL servers behind ODBC, where file-level record locking could not follow. Visual FoxPro survived until 2007 with a devoted following β€” its users were the last of the DOS-era small-business developers, and many of those green-screen apps are still running in warehouses and clinics today.

The pattern in all three stories

Where to learn more

All three run free today: GnuCOBOL compiles COBOL on Linux and Windows, gfortran keeps FORTRAN a first-class scientific language, and the Harbour project implements the xBase dialect β€” or run real dBASE III in DOSBox. Write a payroll loop, a hottest-day finder, and a dues report, and you will touch fifty years of computing history in one afternoon.