real t(500),lat(500),lon(500) integer nos,noa character*2 nom,nog character*10 st(500) integer sti(500) open(21,file='temps',status='old',form='formatted') open(22,file='staz.txt',status='unknown',form='formatted') open(23,file='nos',status='old',form='formatted') open(24,file='noa',status='old',form='formatted') open(25,file='nom',status='old',form='formatted') open(35,file='nog',status='old',form='formatted') open(26,file='stids',status='old',form='formatted') open(27,file='lats',status='old',form='formatted') open(28,file='lons',status='old',form='formatted') c write(22,*) 'Year Month Stid Lat Lon Data' read(23,*) nos read(24,*) noa read(25,*) nom read(35,*) nog do i=1,nos read(26,*) sti(i) if(sti(i).le.9) then st(i)='station00' else if(sti(i).le.99) then st(i)='station0' else st(i)='station' end if end if read(27,*) lat(i) read(28,*) lon(i) read(21,*) t(i) if(sti(i).le.9) then write(22,9001) noa,nom,nog,st(i),sti(i),lon(i),lat(i),t(i) else if(sti(i).le.99) then write(22,9002) noa,nom,nog,st(i),sti(i),lon(i),lat(i),t(i) else write(22,9003) noa,nom,nog,st(i),sti(i),lon(i),lat(i),t(i) end if end if end do 9001 format (I4,2X,A2,2X,A2,2X,A9,I1,2X,F10.3,2X,F10.3,2X,F10.3) 9002 format (I4,2X,A2,2X,A2,2X,A8,I2,2X,F10.3,2X,F10.3,2X,F10.3) 9003 format (I4,2X,A2,2X,A2,2X,A7,I3,2X,F10.3,2X,F10.3,2X,F10.3) stop end