HISTORY 008

The format of the Fortran IV below looked “rs” in youtube viewer. I have got a better result here by leaving out leading spaces in lines. This means that the code will need to be hand-edited (or possibly machine edited) before submitting to a Fortran IV compiler.

This is an examination of Fortran IV code from 1975-1976. What do you think?

This code was not well received by my supervisor. I am wondering now if the reason was that there are redundancies in the specification of the input data,
(i) an extra PAGE record at the end of each chunk, which may be redundant
(ii) a record at the start of each chunk , which may be blank.

IF these are redundancies, then, strictly, by Occam’s razor, they are design faults. It may have been embarrassing to have someone write code that highlighted these issues. I suspect that these oddities were specified because the specifier thought this would make it easier to code. It could only make it easier to code, for someone who does not know how to code properly.

It was quite funny to have incompatibilities (where the code looked ok in one editor but then would not display correctly in the youtube viewer). If the work was being done by one person, they would be told that their work is of unusably low standard. Because the work is done by the industry leader (and I don’t mean youtube), everyone seems to accept it as normality.

My theory is that the industry leader does not do this deliberately - they just happened to notice that their most buggy software is the most profitable - I don’t know why. “Presumably, if they released software that had no bugs, no one would buy it”.

“As far as I know”, the code was used successfully from 1976 for some years, and never failed.

I do not know of any bugs in the code. I looked at it this week in an attempt to infer the requirements.

Any comments on the code are welcomed.

From reading the code, it appears to me that the input consists of a sequence of items, where each item is a “column of data”. A “column of data” consists of a record, followed by a PAGE record, followed by zero or more records which are not RISE records,followed by a RISE record, followed by a PAGE record.

If anyone can offer an explanation for the format of the input data, please let me know by commenting on this post.

I suspect that the first record is blank. I also suspect that the second PAGE record,
which occurs at the end of “column of data”, may be a redundant copy of the first PAGE record, and is put there because the specifier thought that this would make the code easier to write. By Occam’s razor, this is a design fault in the program specification, because it specifies something that is not required, and is therefore unnecessary and should not be there. Maybe this is why my supervisor was so offended by my code.

This is the code for subroutine PROCC
which processes one column of input data.
The code for PRFORM which calls PROCC, and processes all the input data,
has been presented already in the post titled HISTORY 004.

SUBROUTINE PROCC
C use: move one column of input data to output.
C write the output page when it is full.
COMMON/CERR/ERRIN
LOGICAL ERRIN
LOGICAL LMATCH, RD
COMMON/CCOL/ICOL
COMMON/CLINE/LINE
C input
IF (RD(DUMMY)) RETURN
LINE = 1
C output
CALL EMIT
C read a record - branch on EOF
IF (RD(DUMMY)) GO TO 5

C if not “PAGE” record, error exit
IF (LMATCH(4HPAGE)) GO TO 10
C error handling - “PAGE” record not found
5 CALL ERR(3)
ERRIN = .TRUE.
RETURN
C output
10 CALL EMIT
C read a record - branch on EOF
20 if (RD(DUMMY)) GO TO 90
C if “RISE” record, exit from loop to place output at bottom
C of column
IF (LMATCH(4HRISE)) GO TO 30
C error exit if too many lines
IF (LINE.LT.37) GO TO 15
CALL ERR(4)
ERRIN = .TRUE.
RETURN
C output
15 CALL EMIT
GO TO 20
C set line to “RISE” position at bottom of column
30 LINE = 37
C output
CALL EMIT
C read a record - branch on EOF
IF (RD(DUMMY)) GO TO 45
C if not “PAGE” record, error exit
IF (LMATCH(4HPAGE)) GO TO 40
45 CALL ERR(5)
ERRIN = .TRUE.
RETURN
C output
40 CALL EMIT
C step column count
ICOL = ICOL + 1
IF (ICOL.LT.8) RETURN
C print full page of 7 columns
CALL WRIT
ICOL = 1
RETURN
C error handling - EOF on labels file before “RISE” record found
90 CALL ERR(6)
ERRIN = .TRUE.
RETURN
END

Question 1. What is the purpose of the code?
(Is it possible to discover this by reading the code?)
Question 2. Is the code fit for purpose?

Question 3. Is it possible to write better code to do the same job?

Duration : 0:0:2



One Response to “HISTORY 008”

  1. Hero0804 Says:

    eid
    eid

Leave a Reply

Posted on November 4th, 2007 by admin

Filed under Fortran |

|