Silverfrost Forums

Welcome to our forums

Error 94 -Run time error

11 Sep 2005 10:17 #333

I have created the following codes:

 IMPLICIT  REAL*8  (A-H,O-Z)

CHARACTER*16    docing11

common /ycz / g11(100), ng11

 print *, 'Enter   a  length  of  G1'
 read *,  ng11
 print *, 'Enter  G1  file  name'
 read *,  docing11
 open  (1,  file=docing11)
 read  (1,*)  (g11(i)  ,  i=1  ,  ng11)
 close  (unit=1)

  END

 Apparently,  it  resulted  in  a  run  time  error  of  Error  94  -  Unit  has  neither  been  OPENED  nor  preconnected.

  Please  advise  how  to  eliminate  the  probem

Supramaniam
11 Sep 2005 11:48 #335

Your program seems to be OK to me. You should avoid using the value 1 as the unit number because this used for standard I/O. You can step through the code using the debugger (or use print statements) to confirm each step as it is executed.

I assume that the error is occuring on the CLOSE statement. You can check that OPEN has succeeded by using the IOSTAT argument. In this case the file will be created if it does not exist but there will be no data to read in. None of this explains the given run time error message.

14 Sep 2005 9:12 #339

This program works fine, as expected, with me. Though I would prefer using unit number 11 instaed of 1.

[pre] ! Supr.f95 program Supramaniam IMPLICIT NONE

CHARACTER(len=16) :: docing11 integer :: i, ng11 double precision :: g11(100) common / ycz / g11, ng11

print *, 'Enter a length of G1' read *, ng11 print , 'Enter G1 file name' read , docing11 open (1, file=docing11) read (1,) (g11(i) , i=1 , ng11) close (unit=1) write(,'(4es18.4)') g11(1:ng11)

END program Supramaniam

[/pre]

[JvO]

Please login to reply.