[Next] [Up] [Previous] [Home] [Other]

FORTRAN 77

The FORTRAN 77 language, as its name indicates, started life not as an IBM program product, but as an official standard.

One of the new features which Fortran 77 (as it was also known) provided was the CHARACTER datatype, although that already existed as an common extension to FORTRAN IV, and in all the products called FORTRAN V.

Another important addition to FORTRAN with Fortran 77 was the addition of statements within the body of a program to open and close disk files.

Fortran 77 was the last version of FORTRAN that was widely taught in introductory computer courses. Although Fortran 77 included the control structures used for structured programming, languages designed from the ground up to teach good programming habits, such as Pascal, began to be preferred for introductory computer courses.

Other factors were present as well, however. The rise of microcomputers changed the economics of computing, and systems such as UCSD Pascal provided a comfortable programming environment on the Apple II microcomputer as well as on several other microcomputer systems. The availability of FORTRAN compilers for microcomputer platforms lagged considerably behind.

And computers were starting to be more broadly used for purposes other than numerical calculation. While languages such as LISP and SNOBOL were considered to be highly specialized, and thus were studied only by computing science students, C, a language originally designed to write operating systems in (or, more correctly, to write an operating system in, that operating system being the UNIX operating system) was a classic procedural language that was felt to merit consideration.

And then there's Modula-2, Concurrent Pascal, and Ada; these three languages included an important set of features related to making effective use of concurrent processes.

A FORTRAN 77 program might look like this:

C PROGRAM TO SOLVE THE QUADRATIC EQUATION
      READ *, A,B,C
      DISC = B*B-4*A*C
      IF (DISC .LT. 0.0) THEN
        R = 0.0 - 0.5 * B/A
        AI = 0.5 * SQRT(0.0-DISC)/A
        PRINT *, 'TWO COMPLEX ROOTS: ',R,' PLUS OR MINUS ',AI,' I'
      ELSE IF (DISC .EQ. 0.0) THEN
        R = 0.0 - 0.5 * B/A
        PRINT *, 'ONE REAL ROOT: ',R
      ELSE
        SD = SQRT(DISC)
        R1 = 0.5*(SD-B)/A
        R2 = 0.5*(0.0-(B+SD))/A
        PRINT *, 'TWO REAL ROOTS: ',R2,R1
      END IF
      STOP
      END

As can be seen from the example, the IF statement in FORTRAN 77 was now accompanied by an ELSE statement and an ELSE IF statement. READ and PRINT have made a comeback of sorts from FORTRAN II, but with the additional feature that using * instead of the number of a FORMAT statement allows free-format input/output.

Another major addition in Fortran 77 was the standardization of statements for opening files from within a program. In FORTRAN IV, reading and writing from a disk file was handled by assigning the file to an I/O unit other than the standard ones of 5 for input and 6 for output from the command line.

An exclamation mark could be used to begin a comment after a statement.

Shortly after the Fortran 77 standard was adopted, the Department of Defense issued a standard (MIL-STD-1753) requiring some extensions to that language.

One of these extensions was IMPLICIT NONE, which forced Fortran to behave like C and Pascal, requiring all variables to be declared. Also, DO WHILE and END DO were added to the language; END DO could also be used with an ordinary DO statement, but then it would be modified so as not to use a statement number.

Many implementations of FORTRAN IV, even if they were on machines that did not have either sense lights or sense switches available, included the subroutines that replaced the FORTRAN and FORTRAN II statements which dealt with these devices. These features, though, were not typically present in FORTRAN 77 implementations, and were not part of the standard.

Copyright (c) 2007 John J. G. Savard


[Next] [Up] [Previous] [Home] [Other]