forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

NAMELIST in a MODULE error

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
erom



Joined: 26 Oct 2009
Posts: 4
Location: Los Angeles, CA. USA

PostPosted: Mon Jun 14, 2010 8:25 pm    Post subject: NAMELIST in a MODULE error Reply with quote

On an intel microchannel quad cpu 64 bit windows 7
The last downlodable version of SilverFrost Fortran,
- which installed flawless from default administrator protected 32 bit,
builds, debugs, and runs all ok here.

The NAMELIST statement works ok in a MAIN program, the first
example program; The NAMELIST statement does not seem to work in a
MODULE, the second example. .n.g. why ...
Metcalf and Reid seem to say that all module declarations are
replicated in to the program unit/s that USE the module.

PROGRAM NAMELIST_TEST
IMPLICIT NONE
INTEGER :: n
REAL :: x
CHARACTER(len=32) :: word001
NAMELIST /dphotdef/ n , x, word001 ! Declare a namelist
WRITE(*,*) 'Start the namelist_test'
WRITE(*,*) 'Read and print the namelist'
WRITE(*,*)
OPEN ( unit =3, file = 'dphotdefval.dat' )
READ(unit=3,NML=dphotdef) ! Read the namelist
WRITE(*,*)
WRITE(*,NML=dphotdef)
WRITE(*,*)
WRITE(*,*) 'done namelist_test'
END PROGRAM NAMELIST_TEST

A text file named dphotdefval.dat exists in the working directory and
contains:

! test namelist. A comment line
!
&DPHOTDEF ! do not edit the & in this line
n=1, ! integer. an inline comment. comma can be deleted optional
x=1.234567890123456789e000, ! real
word001="abc namelist" ! charter
/ ! do not edit the / in this line
! trailing comment line/s
!

On execution the test returns:

Start the namelist_test
Read and print the namelist
&DPHOTDEF
N = 1
X = 1.23457
WORD001 = 'abc namelist '
/
done namelist_test
Press RETURN to close window . . .

Ok fine so far.
Now the build consists of 2 program units, a MAIN and a MODULE

PROGRAM NAMELIST_TEST
USE namelistmodule
CALL namelistvars
END PROGRAM NAMELIST_TEST

MODULE namelistmodule
IMPLICIT NONE
NAMELIST /dphotdef/ n , x, word001
INTEGER :: n
REAL :: x
CHARACTER(len=32) :: word001
CONTAINS
SUBROUTINE namelistvars
OPEN ( unit=10, file = 'dphotdefval.dat' )
READ(unit=10, NML=dphotdef)
CLOSE(unit=10)
WRITE(*,NML=dphotdef)
END SUBROUTINE namelistvars
END MODULE namelistmodule

Builds ok,
execution returns :
Run-time Error
*** Error 204, Invalid identifier in namelist input group
00401000 NAMELISTMODULE!NAMELISTVARS [+00b7]
00401180 main [+0042]

This last example runs just fine on Intel Linux FORTRAN 11.1-072


Last edited by erom on Tue Jun 15, 2010 8:27 pm; edited 2 times in total
Back to top
View user's profile Send private message
Martin



Joined: 09 Sep 2004
Posts: 43

PostPosted: Sun Jun 20, 2010 10:13 pm    Post subject: Reply with quote

Hi erom,

I have reproduced your problem. It looks like it only occurs when a contained subroutine attempts to read the namelist - perhaps as a workaround you could read it from a normal subroutine instead?

I'll log this as a bug and we'll look into it soon.

Thanks for reporting it.

Martin
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group