- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi.
I have a bizarre error which is shown by the skeleton code below.
Basically, I have a character variable which I have placed with a namelist. I initilaise the string and write the namelist to a file. I rewind the file and read the namelist. It works fine if the length of the character string is 122 but if I put it to 123 (as in the code) it fails with IOSTAT=18 which is 'too many values for NAMELIST variable'.
I am using Intel Fortran XE 12.0.4.196 in VS2010
In the full program the character string will be much longer so I did some trial and error to see what was the critical point and as far as i know, 122 has no significance whatsoever.
I have tried setting CARRIAGECONTROL='NONE' and BLOCKSIZE=123' on the OPEN statement but doesn't make any difference.
Code also works fine with gfortran.
Any ideas?
PROGRAM MAIN
! Program to test namelist read
IMPLICIT NONE
CHARACTER(LEN=123) :: CString
CHARACTER(LEN=150) :: Message
NAMELIST /TestNL/CString
INTEGER :: Ios
INTEGER :: I
OPEN(6,file='stdout.txt',form='formatted')
OPEN(10,file='test.nl',form='formatted')
DO I=1,123
CString(I:I) = 'A'
ENDDO
WRITE(10,TestNL)
REWIND(10)
READ(10,TestNL,IOSTAT=Ios,IOMSG=Message)
write(6,*) 'ios ',ios
if(ios /= 0) write(6,*) 'Message: ',Message
write(6,*) CString
STOP
END
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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