- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
WRITE(UNIT=post_file,FMT=*)
or
WRITE(post_file,*)
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Consider that if you had this:
WRITE (ERR=300,*) X
Is the * the UNIT or the FMT?
Steve

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page