Additional Notes

 

Text Box: September 5th, CS-530, 2 o’clock section, Lecture #3 
Relevant for both sections

 

 

 

 

!!!REMEMBER!!!

 

Note that

Base Address + Width of Element * number of elements to skip

 

The following remarks were made when we looked at and discussed SUBROUTINE SILLY

·        NUM1 and NUM2 are integers because they start with an N

·        WRITE(6,12) : 6 was associated with a specific output device, and 5 was associated with a specific input device.  This made the programs portable.

·        WRITE(6,12) : 12 is a label referring to a FORMAT statement (format descriptor)

·        FORMAT(1X, I10, I10) is a FORMAT statement.

o       I10 means is an integer right justified in a field of 10

o       In a READ statement I10 would pick up 10 columns worth of digits as an integer

o       In a READ statement F10.5 would pick up 10 columns worth of digits and place the decimal point to the left of the last 5 of them (i.e. 10 is the total number of columns picked up, 5 is the number of digits after the decimal point)  Note that IF there were a decimal point within the 10 columns, it would override the format.

 

 

 

 

 

 

!!!REMEMBER!!!

 

 

WRITE (6, 10)

10        FORMAT (1X, “This is a royal pain”)

 

 

In the old days, we were able to do this:

 

 

computed GO TO = multiway branch

 

Example2.f = syntax illustration of a computed GO TO statement

 

I = 5

GO TO (15, 26, 43, 56, 12)  I

If I is greater than 5 it will go to the next line of code instead of transferring to one of the numbered statements

 

Various subsequent versions of the program are on the web.

 

!!!REMEMBER!!!

 

DIMENSION statements were used in early Fortran for arrays and identifiers for arrays used names representing the default types.   

Input and output files:

C:\ prog1 < one.txt (input)

C:\ prog1 > one.txt (output)

C:\prog1 < one.in > one.out

C:\prog1 <adams.in > chip.out

 

 

These statements refer to the FORTRAN  NOTES:

·        (7) values in DATA statements are assigned to variables at compile time. DATA statement are not executable statements

·        (10) Answer = SUM(5.0, 6.0, 7.0) – SUM (5.0, 6.0, 7.0) is a call to FUNCTION SUM.  The returned value replaces the call and needs to be assigned (stored) in another variable.  No recursive function calls in early FORTRAN.  Partially due to the convention of storing the return address in a particular register.

·        (11) ERR= label – was an early exception handling statement.  Used when inputting data.  If the wrong type of data was entered control would transfer to the statement with the label label.