gsuaaa@blake.acs.washington.edu (Brian Chan) (10/06/89)
How do I solve the following problem? I need to read data (and to process them real time) from a text file which grows continuously over a 24-hour period. The sample code listed as followed: Program whatever implicit none character*25 inputf character*6 time_current character*7 inputf /"c100489"/ integer*2 iunit /20/ integer*2 i_ios /0/ open(iunit, file=inputf, status='old', carriagecontrol='LIST', maxrecl=80, position = 'START') call get_time(time_current) ! get current time do while (time_current .le. '235959') ! while it's not the end of day do while (i_ios .eq. 0) ! do while not eof() read(iunit, fmt='(A)',iostat=i_ios) string80 print *, string80 ! print to screen enddo call delay(15 seconds) c if eof() then wait 15 sec. Reopen the file to read some more data c from the last read. (It didn't work.) open(iunit, file=inputf, status='old',carriagecontrol='LIST', + maxrecl=80, position = 'CURRENT') print *, "Gee, there're more..." call get_time(time_current) enddo ........... According to P.5-20 from the Data General F77 program manual, " POSITION = pos POSITION allows you to position the file to its start, end, or current postion. pos ... 'START','CURRENT', or 'END'. On the first OPEN of a file, the current positon is the start position. On subsequent OPEN statements (reopens) of this file, the current position set during the previous OPEN will be carried over...." When I execute the above code on a Data General S140 running AOS, it will keep printing "Gee, there're more" once it reached the eof in the first do-loop. In other words, the program didn't re-open from its last read. Once it reached eof, even though there're more data added to file - inputf, it will not print those new data. Hummm... I am new to Fortran. Would someone give me some hints? Do I need to make some low-level system calls to keep track of its' file pointer? Thank you very much for your assistance in advance, Brian Chan Internet address: gsuaaa@blake.acs.washington.edu or bchan@eur.dca.mil