Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29249 Discussions

Invalid Specifier Problem on Windows

cainlord
Beginner
2,085 Views
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
save

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"

open(UNIT=post_file,FILE=junk_string,ACTION="WRITE",STATUS="REPLACE")
write(UNIT=post_file,*) "K= :", k
close(unit=post_file)

end program winwrite



0 Kudos
2 Replies
james1
Beginner
2,085 Views
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:

WRITE(UNIT=post_file,FMT=*)

or

WRITE(post_file,*)

James
0 Kudos
Steven_L_Intel1
Employee
2,085 Views
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?

Steve
0 Kudos
Reply