replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - input, reading from files problem.
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 

input, reading from files problem.

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



Joined: 25 Jan 2013
Posts: 4

PostPosted: Fri Jan 25, 2013 5:36 pm    Post subject: input, reading from files problem. Reply with quote

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
View user's profile Send private message
dpannhorst



Joined: 29 Aug 2005
Posts: 165
Location: Berlin, Germany

PostPosted: Fri Jan 25, 2013 6:18 pm    Post subject: Reply with quote

Line 7 must be:

READ(UNIT=7,*) SVA(J,1)

Detlef
Back to top
View user's profile Send private message Visit poster's website
mbly



Joined: 25 Jan 2013
Posts: 4

PostPosted: Mon Feb 25, 2013 10:07 pm    Post subject: Reply with quote

thanks
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2615
Location: Sydney

PostPosted: Tue Feb 26, 2013 6:26 am    Post subject: Reply with quote

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
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