导致报错:Fortran runtime error: End of file
数据展示如图
Fortran报错如图
代码:
[Fortran] 纯文本查看 复制代码 program wwlln_2009_text
implicit none
character(len=512)::cRead
character(len=20)::filename,DYfilename
character(len=20)::wwlln_date,wwlln_time
real::lat,lon
character(len=5)::timingerror
character(len=2)::station
integer::status1=0
integer,parameter::fileid1=12,fileid2=13
integer::i
logical alive
OPEN(14,file="A20090101.txt",status="old",form="formatted")
OPEN(15,file="20090101.txt",status="replace")
do while(.true.)
READ(14,"(A512)",iostat=status1)cRead
if(status1/=0) exit
CALL parserRead(cRead)
write(*,*)wwlln_date,wwlln_time,lat,lon,timingerror,station
if((lat>21).AND.(lat<34).AND.(lon>97).AND.(lon<111)) then
write(*,*)wwlln_date,wwlln_time,lat,lon,timingerror,station
write(15,*)wwlln_date,wwlln_time,lat,lon,timingerror,station
end if
end do
CLOSE(14)
close(15)
contains
!调用子程序
subroutine parserRead(c)
character(len=*)::c
integer::j
do j=1,LEN_TRIM(c)
if (c(j:j)=="/") c(j:j)="|"
end do
READ(c,*)wwlln_date,wwlln_time,lat,lon,timingerror,station
do j=1,LEN_TRIM(wwlln_date)
if (wwlln_date(j:j)=="|") wwlln_date(j:j)="/"
end do
end subroutine parserRead
end
请问大家,这种情况该怎么让程序继续下去!
|