Folks,
In the program below, I'm just trying to read in / write out a file under
Windows (I'm under XP and haven't "upgraded" to the latest to come out of
Redmond if it makes any difference). Program executes normally, but I get
the header on unit 4 but nothing else. Also would like to end with an
end-of-file on unit 5, but haven't figured that one out either.
Appreciate any help.
Ernest Blair
Sr. Modeling & Simulation Eng. - Operations Research
Future Combat Systems, Lead Systems Integration Team, Manned Ground Vehicles
- SAIC, 4110 Campus Point Ct, M/S E3-X, San Diego, CA 92121
______________________________________
tel: 858-826-5138 fax: 858-826-5129
[log in to unmask]
----------------------------------------------------------------------------
-----
program read_data4
character (len=107) :: a1
character (len=3) :: Away,Home,Dir,Adom,Hdom,away2,home2,day
character (len=5) :: WX,Aturf,Hturf
real :: tline,sline
integer :: Year,Wk,ACode,HCode,Tmp,Vel,Hum,ascr,hscr,seq,ios5,ios4,end5,i
open(unit=5, iostat=ios5, status="old", action="read", position="rewind", &
access="sequential", form="formatted", &
file="c:\documents and
settings\ernie\desktop\masterfiles\data\wx_data.txt")
open(unit=4, iostat=ios4, status="replace", action="write",
access="sequential", &
position="rewind", form="formatted", &
file="c:\documents and
settings\ernie\desktop\masterfiles\data\wx_data_out.txt")
! read/write header
read (unit=5, fmt=*) a1
write (unit=4, fmt=*) a1
! read/write Weather info
do i = 1,10000
read (unit=5, fmt=*, iostat=end5)
Year,Wk,Away,Home,ACode,HCode,Tmp,Dir,Vel,Hum,&
WX,Adom,Hdom,Aturf,Hturf,away2,ascr,tline,day,home2,hscr,sline,seq
if (Year == 2999) then
exit
write(unit=4, fmt=*) Year,Wk,Away,Home,ACode,HCode,Tmp,Dir,Vel,Hum,&
WX,Adom,Hdom,Aturf,Hturf,away2,ascr,tline,day,home2,hscr,sline,seq
end if
end do
close (unit=5, status="keep")
close (unit=4, status="keep")
end program read_data4
-----------------------------------------------------------------------
|