Scor­pio News

  

January–March 1987 – Volume 1. Issue 1.

Page 9 of 63

An Introduction to FORTRAN

by P.D. Coker

(In this article, F80 refers to Microsoft FOR­TRAN-80, ProFortran to the 8-bit Version of FOR­TRAN from Prospero Software. NFortran refers to Ellis Computing’s Nevada Fortran and FOR­TRAN refere to other versions such as FOR­TRAN IV oF FOR­TRAN 77.)

Why Use Fortran?

FOR­TRAN is, as computer languages go, very old, having first seen the light of day about 30 years ago as a scientific and technical high level language for early IBM mainframes – it’s older than ALGOL and BASIC (which owes a lot of its style to FOR­TRAN II) and, by comparison, PASCAL and C are infants!

Most users are aware of the drawbacks of interpreted languages – particularly in terms of execution time. FOR­TRAN is a compiled language in which the source code is written using a text editor and then compiled into a run-time package which will execute much move rapidly than is the case with an interpreted language. There are two disadvantages to this, however. One is that any amendments which need to be made to the program involve editing and recompiling the source code which can be tedious. The other problem is one of cost. Virtually all compiled languages are expensive (£150 – 350), although HiSoft PASCAL (a very satisfactory version) costs quite a lot less. There is a very good FOR­TRAN compiler, sold by Grey Matter of Ashburton, South Devon which is incredibly cheap. For £30 you get Nevada Fortran and a useful Guide – admittedly, the implementation of FOR­TRAN is not complete – but few will miss the bits the author has left out!

So, if you are fed-up with your BASIC and want to try a compiled language, then it really is worthwhile trying NFortran. True, FOR­TRAN is a little less flexible and efficient than PASCAL but the conversion of programs from BASIC to FOR­TRAN is relatively simple and straightforward. I must admit to being professionally biased in favour of FOR­TRAN but some versions of PASCAL are very finicky about syntax.

Program Structure

In BASIC, program entry is very straightforward with line numbers and statements typed in directly but in FOR­TRAN, the program statements must first be entered using a text editor such as WordStar (in non-document mode) or PEN before calling the compiler. All versions of FOR­TRAN use up to 80 columns per line of input, organised as follows:

Cols1 – 5Optional statement number (1 – 99999)
Col6‘Continuation’ character field (used only if the number of columns used by the statement exceeds 72)
Cols7 – 72FOR­TRAN statement
Cols73 – 80(can be used for identification, rude words or whatever)

COMMENTS

In BASIC, REM statements (or comments preceded by single quote (') can be used to highlight information about programs. In FOR­TRAN, the use of a letter C in column 1 performs the same function; lines so marked are ignored by the compiler


Page 9 of 63