 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
mbly
Joined: 25 Jan 2013 Posts: 4
|
Posted: Fri Jan 25, 2013 5:36 pm Post subject: input, reading from files problem. |
|
|
I'd appreciate some help with what I'm doing wrong:
PROGRAM SNAP
INTEGER :: SVA(500000,1),J
WRITE(*,*) "BEGIN"
OPEN (UNIT=7,ACCESS="DIRECT",STATUS="OLD",RECL=500000, &
FILE="N:CASE1.TXT",ACTION="READ")
DO 5 J=1,500000,1
READ(*,UNIT =7) SVA(J,1)
5 CONTINUE
CLOSE(UNIT=7,STATUS="KEEP")
WRITE (*,*) "DONE ENTERING VALUES"
WRITE(*,*) SVA(500000,1)
END PROGRAM SNAP
Compiling and linking file: FreeFormat1.f95
C:\Users\mike\Documents\FreeFormat1.F95(7) : error 265 - Duplicate UNIT keyword in READ control list
Compilation failed.
thanks in advance.
mike |
|
Back to top |
|
 |
dpannhorst
Joined: 29 Aug 2005 Posts: 165 Location: Berlin, Germany
|
Posted: Fri Jan 25, 2013 6:18 pm Post subject: |
|
|
Line 7 must be:
READ(UNIT=7,*) SVA(J,1)
Detlef |
|
Back to top |
|
 |
mbly
Joined: 25 Jan 2013 Posts: 4
|
Posted: Mon Feb 25, 2013 10:07 pm Post subject: |
|
|
thanks |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Tue Feb 26, 2013 6:26 am Post subject: |
|
|
Your read statement is not compatible with your file being declared as DIRECT and RECL = 500000 (4_byte words)
Where did you get the file "N:CASE1.TXT" from ?
If it wasn't created by FTN95 you might have more problems to deal with it as a direct access file.
(Check what record length the file should be.)
A likely change could be:
from:
DO 5 J=1,500000,1
READ(*,UNIT =7) SVA(J,1)
5 CONTINUE
to:
READ (unit=7, rec=1) SVA(:,1)
Also, why is SVA declared as rank 2 ?
Do you want to write out 500,000 values or only the last one ?
John |
|
Back to top |
|
 |
|
|
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
|