I agree with Eddie, however, what the first iteration of this program will do is to read four values from the first line of the file, and it will only do this correctly if the data in the file is arranged:
- in columns of 12 characters wide, or
- each column is less than 12 characters and is separated with a comma and has decimal points present
When working out formats, I find it useful to use F for a fractional column,I for integer, X for space etc, and if two similar formats are adjacent, then alternate the case.
For example, the format expects 7F12.3 looks like with some examples under it:
ffffffff.fffFFFFFFFF.FFFffffffff.fffFFFFFFFF.FFFffffffff.fffFFFFFFFF.FFFffffffff.fff
9 25 40 123
9,25,40,123
9.,25.,40.,123.
For the first example, you might expect results of 9, 25, 40 & 123, but you will probably get 90000, 25, 4 & 0.123
The second example overrides the spacing, but on reading pushes everthing right to the edge of each format and the result will be 0.009, 0.025, 0.040 & 0.123.
The third example also overidded the position of the decimal place and you will get the correct input. On input, it is better to use a wide format with zero decimal places, like 4F20.0, and override it with commas, the decimal places for whole numbers are not then required, but supplying a decimal place will also work for fractional values.
That said, the program only reads four values from each line as each sequential read starts at the start of a new line.
If the data in your file was for example, using values of the form 'row.column' for easy identification of the results.
1.1, 1.2, 1.3, 1.4
2.1, 2.2, 2.3, 2.4
3.1, 3.2, 3.3, 3.4
.
.
.
.
.
9.1, 9.2, 9.3, 9.4
Then the arrays would be filled thus:
I A(I) B(I) C(I) D(I)
1 undef undef undef undef
2 undef undef 1.3 1.4
3 1.1 1.2 2.3 2.4
4 2.1 2.2 3.3 3.4
5 3.1 3.2 4.3 4.4
6 4.1 4.2 5.3 5.4
7 5.1 5.2 6.3 6.4
8 6.1 6.2 7.3 7.4
9 7.1 7.2 8.3 8.4
10 8.1 8.2 9.3 9.4
11 9.1 9.2 undef undef
The dimensions of A, B, C & D are assumed to be A(11), B(11), C(11) & D(11) or greater.
I hope this helps.
Regards
Ian
PS, forgot to say, instead of a format number in the read, use an asterisk.