On 02/12/2016 3:19 PM, Nat wrote:
...
> For example, I have the following file:
>
> -54.9;-67.6;0.0104046;
> -54.8;-68.3;1.07319;
> -54.5;-67.2;0.0627663;
...
> I have tried the following read statements but neither of them worked.
>
> read(1,*) lat,lon, valdata
> Fortran runtime error: Bad real number in item 1 of list input
Doesn't follow list-directed rules (semicolon)
> read(1,'(2(f2.1,a),e10.2,a)') lat,lon, valdata
> Fortran runtime error: Bad value during floating point read
> read(1,'(2(f2.1,a),e10.2,a)') lat,lon, valdata
The first two fields aren't F2.1, the form is Fw.d where s is the field
width which is the _total_ field width, not the number of digits before
the decimal.
...
read(lu,2(F5.1,1X),F???
You still run into trouble because the last field isn't fixed-width and
the trailing semicolon will cause a general F or E to fail.
Just commenting on the misunderstanding regarding definition of field
width primarily, Steve Kargl gave you the ways to solve the problem.
--