help me to run the fotran77 coding

Hello guys, I got problem to run the 365days (1year) data. For every data 10min gap. thats mean got 60,000++ data i need to calculate the average temperature. I need to run a program data to read monthly average temperature in 2014 for every month. here my program:

real tair(144,63129)
real winds,windd,solarrad,ave1
integer x
character(10) :: date
character(5) :: time
character (5) :: t
open (unit=3,name=‘prnla.prn’,status=‘unknown’)
open (unit=7,name=‘result’,status=‘new’)

write (7,23)
23 format(7x,‘DAY’,2x,‘DATE’,7x,‘TIME’,3x,‘AIR-TEMP’)
do i=1,n_y
do j=1,n_d1
read (3,30) date,time,tair(i,j),relh,solarrad,winds,windd
30 format (a10,3x,a5,3x,f5.2,3x,f5.2,2x,f6.2,1x,f7.5,1x,f7.3)
write(7,80) i,date,time,tair(i,j)
end do
80 format(3x,i5,3x,a10,2x,a5,3x,f5.2,3x,f5.2)
88 format (‘Ave1=’,f5.2)
end do
close (3)
close (7)

the problem in my coding is the month only running for 30days a month. but cannot read in 31days. so how i wanna doing nested loop for read the 30days and 31 days a month.

The declaration style you use, as well as the source form are f90+ …

I’d suggest:

  1. get rid of the format statements. For example
    write (7,23)
    23 format(7x,‘DAY’,2x,‘DATE’,7x,‘TIME’,3x,‘AIR-TEMP’)

Can become

write(7,’(7x,“DAY”,2x,“DATE” …)’) but this has nothing to do with your question

Hard coded constants like “30” suggest a class of error (if it’s 30 how do you plan to accommodate 31 day months).

If you are trying to process the data in month sized batches, dimension for 31, and read to end of record …

Is this a class project of some sort? It seems a bit contrived (or perhaps you’ve done a good job of reducing the problem to the simplest case illustrating your issue … it’s a bit unclear …)