44 Part I • Information Technology
100 machine language instructions per 4 GL instruction).
Furthermore, although each type of computer has its
unique 2 GL, the 3 GLs and 4 GLs are largely machine
independent. Thus, a program written in a 3 GL or 4 GL
can be run on many different types of computers, which is
a significant advantage.
Third generation languages are also called
procedural languages,because they express a step-by-step
procedure devised by the programmer to accomplish the
desired task. Of course, these steps in the procedure must be
expressed in the particular statement types available in
the given procedural language. The earliest procedural lan-
guage was FORTRAN (an abbreviation for FORmula
TRANslator), which was developed by IBM in the mid-
1950s. Other popular procedural languages include COBOL
(COmmon Business Oriented Language), BASIC, and C.
A source program in any one of these languages must
be translated into the machine language object program
before the computer can carry it out. For 3 GLs (and for
4 GLs), the language translator is called a compilerif the
entire program is translated into machine language before
any of the program is executed, or an interpreterif each
source program statement is executed as soon as that single
statement is translated. Figure 2.10 depicts the process of
compiling and running a compiled procedural language
program, such as COBOL. The key is that the entire program
is translated into an object program, and then the object pro-
gram is loaded and executed. With an interpreter, only one
statement from the source program is considered at a time.
This single statement is translated into machine language,
and if no errors are encountered, it is immediately executed.
The process is repeated, statement after statement.
The procedural languages do not enjoy the near-total
dominance of 20 years ago, but they are still the languages
of choice for many computer professionals, scientists, and
engineers. Estimates vary, but it is likely that at least half
of the programs in use today were written in 3 GLs. The 4
GLs, object-oriented languages, and other newer lan-
guages have gained ground on the 3 GLs, but they will not
replace the 3 GLs in the next few years. The 3 GLs are
entrenched, and new, more powerful versions (e.g., object-
oriented versions) of the 3 GLs continue to be developed.
Perhaps most important, there are literally millions of pro-
cedural language programs already in use in businesses
and other organizations and, in most cases, it is more eco-
nomical to maintain and update these “legacy” programs
than to rewrite them in newer languages.
COBOL We will use COBOL, which is an acronym for
COmmonBusiness-OrientedLanguage, as an example of
a procedural language. COBOL was developed by a com-
puter industry committee (originally the short-range com-
mittee of the Conference on Data Systems Languages, or
CODASYL; later the COBOL Committee of CODASYL)
in order to provide an industry-wide common language,
closely resembling ordinary English, in which business
data processing procedures could be expressed. Since its
inception in 1960, COBOL has gained widespread accept-
ance because it is standardized, has strong data manage-
ment capabilities, and is relatively easy to learn and use.
COBOL is by far the most popular language for program-
ming mainframe computers for business applications.
COBOL programs are divided into four distinct divi-
sions. The first two divisions are usually fairly short. The
IDENTIFICATION DIVISION gives the program a name,
and the ENVIRONMENT DIVISION describes the com-
puter environment in which the program will be run.
The ENVIRONMENT DIVISION is also the portion of
the program that has to be changed to transport the
program from one computer model to another. The DATA
DIVISION, which is often quite lengthy, defines the file
structures employed in the program. The PROCEDURE
DIVISION corresponds most closely to other procedural
language programs; it consists of a series of operations
specified in a logical order to accomplish the desired task.
The combination of all these divisions, especially the
DATA DIVISION, makes COBOL programs quite long
compared with other procedural languages. COBOL has
been correctly described as a verbose language.
Our sample COBOL program is designed to compute
and print monthly sales commissions for the salespersons
Procedural
Language
Program
SOURCE
PROGRAM
Computer
(under control
of compiler)
Computer
Executes the
Machine
Language
Program
Load
the
Machine
Language
Program
Machine
Language
Program
OBJECT
PROGRAM
Data
Reports
FIGURE 2.10 Compiling and Running a Procedural Language
Program