READ ( UNIT = TRIM(String),...

François-Xavier Coudert fxcoudert@gmail.com
Mon Oct 29 10:12:00 GMT 2007


> READ ( UNIT = TRIM(String), FMT = *, IOSTAT = IO_Stat ) Number
>                   1
> Error: UNIT specification at (1) must be an INTEGER expression or a
> CHARACTER variable
>
> Is this warranted by the standard?

Yes. From Fortran 2003, section 9.4 "File Connection":

R901 io-unit is file-unit-number or * or internal-file-variable
R902 file-unit-number is scalar-int-expr
R903 internal-file-variable is char-variable

So gfortran's message is very much on par.

> Now for the really weird part, if I remove the 'TRIM' to get over this,
> I would expect an IO error to be raised, but I have yet to find a
> compiler which does!

I don't know. Since gfortran's behaviour is similar to other
compilers, it's probably a language question and would be better
directed to comp.lang.fortran.

FX



More information about the Fortran mailing list