46 Part I • Information Technology
OTHER PROCEDURAL LANGUAGES There are many
procedural languages in addition to COBOL, but we will
mention only three of the more important ones. As noted
earlier, the granddaddy of the procedural languages is
FORTRAN. After it was introduced in the mid-1950s, it
quickly became the standard for scientific and engineering
programming. FORTRAN is still widely used today, in
good part because of the significant investment made in the
development of FORTRAN scientific software.
BASIC is the simplest of the widely used procedural
languages. BASIC, which is an acronym for Beginner’s
All-purposeSymbolicInstructionCode, was developed in
the early 1960s by John Kemeny and Thomas Kurtz at
Dartmouth College. Their purpose was to create an easy-
to-learn, interactive language for college students that
would let the students concentrate on the thought processes
involved in programming rather than the syntax. Newer
versions of the BASIC language have greatly expanded the
capabilities of the language.
C, which was written by Dennis Ritchie and Brian
Kernighan in the 1970s, is a very important language
for scientific and engineering programming. C is a very
powerful language but hard to use because it is less
English-like and closer to assembly language than the
other procedural languages. C was originally developed
for and implemented on the UNIX operating system, and
its use grew as UNIX spread. In fact, the UNIX operating
system was written in C. C has been adopted as the
standard language by many college computer science
departments, and it is widely used on microcomputers.
On large research computers, it is not unusual for C and
FORTRAN to be the only languages ever used.
Fourth Generation Languages
Fourth generation languages—also called productivity
languagesandnonprocedural languages—are even easier
to use than the third generation languages. To employ a
PROCEDURE DIVISION.
MAIN–CONTROL.
PERFORM INITIALIZATION.
PERFORM READ–PROCESS–PRINT UNTIL THERE–IS–NO–MORE–DATA.
PERFORM COMPLETE.
STOP RUN.
INITIALIZATION.
OPEN INPUT SALES–FILE, OUTPUT COMMISSIONS–FILE.
MOVE SPACES TO COMMISSION–RECORD.
READ-PROCESS–PRINT.
READ SALES–FILE INTO SALES–RECORD
AT END MOVE ‘N’ TO MORE–DATA.
IF THERE–IS–MORE–DATA
MOVE NAME TO NAME–OUT
MOVE SALES TO SALES–OUT
IF SALES GREATER 50000
COMPUTE TEMP–COMMISSION = .01*50000+.02* (SALES–50000)
ELSE
COMPUTE TEMP–COMMISSION = .01*SALES
MOVE TEMP–COMMISSION TO COMMISSION
WRITE PRINT–RECORD FROM COMMISSION–RECORD
AFTER ADVANCING 1 LINES
ADD TEMP–COMMISSION TO TOTAL–COMMISSIONS.
COMPLETE.
MOVE TOTAL–COMMISSIONS TO TOTAL–COMM–EDITED.
DISPLAY ‘TOTAL–COMMISSIONS ARE’ TOTAL–COMM–EDITED.
CLOSE SALES–FILE, COMMISSIONS–FILE.
1 8 12
FIGURE 2.11 COBOL Program (Continued)