Invalid Specifier Problem on Windows

Invalid Specifier Problem on Windows

When building my executable I run into the following error message:

winwrite.f90(22) : Error: A * specifier is invalid at this point in the control list.
write(UNIT=post_file,*) "K= :", k

I have built this same file correctly on our sun-based system. I am running Compaq Visual Fortran Optimizing Compiler Version 6.6 (Update A). Here is a simple source version:

module winwrite_mod

implicit none

integer, parameter :: post_file = 952
end module winwrite_mod

program winwrite

use winwrite_mod
implicit none

integer :: k
character(len=3) :: junk_string

k = 3
junk_string = "foo"

write(UNIT=post_file,*) "K= :", k

end program winwrite

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

You are using a formal argument name for UNIT in the WRITE statement, then expecting the format to be accepted positionally. Your write statement should be either:





To expand on James' correct response - in Fortran, once you use a keyword argument name (or I/O control list keyword), you must use keywords for all subsequent arguments. It seems that Sun has an extension which your program took advantage of, but Visual Fortran doesn't support that.

Consider that if you had this:

WRITE (ERR=300,*) X

Is the * the UNIT or the FMT?


Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today