c Delete (or substitute) lines in plouff file with station name as the c search key. 80-column records. Burch format no longer implemented. character*65 infile,auxil,outfile,auxleft,inleft character b(9000)*72,e*72,ans*1,s(9000)*8,sta*8 logical exists data ifd,ifrec,n,m,l,i,left/7*0/ c infile(7)-input file. auxil(8)-stations to be deleted, substituted, c nullified. outfile(9)-output file. auxleft(10)-stations from auxil c that were not found in infile. inleft(17)--deleted from infile. print 100 100 format (' SUBSTUT, Plouff, 1-95. Delete, replace, or nullify ', 1 'stations in plouff-',/,' format files with a search based on', 2 ' a match of unique station names.') print 101 101 format (' TYPE the name of the plouff file to be modified:') read 565, infile 565 format (a65) inquire (file=infile,exist=exists) if (.not. exists) then print 102 102 format (' That file was not found. Try once more.') print 101 read 565, infile inquire (file=infile,exist=exists) if (.not. exists) then print 103 103 format (' **STOP. That file also was not found.') stop end if end if print 106 106 format (' Are data points to be replaced in the input file?') read 501, ans 501 format (a1) if (ans .eq. 'y' .or. ans .eq. 'Y' .or. ans .eq. ' ') go to 3 ifd=1 print 107 107 format (' Are stations to be deleted from the input file?') read 501, ans if (ans .eq. 'y' .or. ans .eq. 'Y' .or. ans .eq. ' ') go to 3 ifd=-1 print 108 108 format (' Therefore, the positions of the matched station names', 1 ' in the input file will',/,' be retained, but coordinates ', 2 'will be reset to zero (nullified).') 3 print 109 109 format (' A supplementary file supplies station names or new ', 1 'data points.') print 110 110 format (' TYPE the name of the supplementary file:') read 565, auxil inquire (file=auxil,exist=exists) if (.not. exists) then print 102 print 110 read 565, auxil inquire (file=auxil,exist=exists) if (.not. exists) then print 103 stop end if end if print 111 111 format (' TYPE the name of a revised file to be created:') read 565, outfile inquire (file=outfile,exist=exists) if (exists) then print 112 112 format (' That file already exists. Do you want to STOP to ', 1 'save it?') read 501, ans if (ans .eq. 'y' .or. ans .eq. 'Y' .or. ans .eq. ' ') stop end if print 113 113 format (' TYPE the name of the file [.lft] to store unmatched ', 1 'data points from the',/,' supplementary file:') read 565, auxleft inquire (file=auxleft,exist=exists) if (exists) then print 112 read 501, ans if (ans .eq. 'y' .or. ans .eq. 'Y' .or. ans .eq. ' ') stop end if print 114 114 format (' Do you want to create a file for data points that ', 1 'were deleted, replaced,',/,' or nullified?') read 501, ans if (ans .eq. 'y' .or. ans .eq. 'Y' .or. ans .eq. ' ') go to 4 go to 24 4 ifrec=1 print 115 115 format (' TYPE the name of that [.del] file:') read 565, inleft inquire (file=inleft,exist=exists) if (exists) then print 112 read 501, ans if (ans .eq. 'y' .or. ans .eq. 'Y' .or. ans .eq. ' ') stop end if open (17,file=inleft,form='formatted',status='unknown') 24 open (7,file=infile,form='formatted',status='old') open (8,file=auxil,form='formatted',status='old') open (9,file=outfile,form='formatted',status='unknown') 5 n=n+1 if (n .gt. 9000) go to 9 c 80 or less columns read (8,803,err=9,end=10) s(n),b(n) 803 format (a8,a72) if (s(n) .eq. ' ') then print 117, n 117 format (' **STOP. Blank or duplicate station name on line', 1 i5,' of supplementary file.') go to 99 end if nm=n-1 do 29 j=1,nm if (s(n) .ne. s(j)) go to 29 print 117, n go to 99 29 continue go to 5 9 print 116, n 116 format (' **STOP. Format error on line',i5,' of supplementary ', 1 'file or >9,000 lines.') go to 99 c After last supplementary station is read: 10 n=n-1 print 118, n 118 format (i6, ' stations in the supplementary file.') kk=n 11 m=m+1 if (m .gt. 9000) go to 21 read (7,803,err=21,end=22) sta,e if (sta .ne. ' ') go to 14 print 119 119 format (' **STOP. Blank or duplicate station name on line',i5, 1 ' of input file.') go to 99 c Skip search section after comparison-lines used up. 14 if (l .eq. n .or. i .eq. n) go to 19 c Start dual loop k1=kk+1 loop=0 if (k1 .gt. n) k1=1 k2=n 15 do 18 j=k1,k2 if (s(j) .ne. sta) go to 18 c A match is found kk=j if (ifd .le. 0) go to 16 c deletion l=l+1 go to 25 c Nullification. Save station name to preserve position. 0 location. 16 if (ifd .lt. 0) write (9,802) s(j) 802 format (a8) c substitution/replacement if (ifd .eq. 0) write (9,803) s(j),b(j) i=i+1 c Create a file of stations replaced in input file 25 if (ifrec .eq. 1) write (17,803) sta,e s(j)=' ' c Read next line go to 11 18 continue loop=loop+1 if (loop .eq. 2 .or. k1 .eq. 1) go to 19 k2=k1-1 k1=1 go to 15 19 write (9,803) sta,e go to 11 21 print 120, m 120 format (' **STOP. Format error on line',i5,' of input file.') go to 99 c After last line is read in input file 22 m=m-1 print 121, m,l,i 121 format (i5,' stations in input file.',/,i5,' stations were', 1 ' deleted and',i5,' were replaced or nullified.') do 23 j=1,n if (s(j) .eq. ' ') go to 23 left=left+1 s(left)=s(j) if (left .eq. 1) open (10,file=auxleft,form='formatted', 1 status='unknown') c Deletions or nullifications; replacements if (ifd .ne. 0) write (10,802) s(j) if (ifd .eq. 0) write (10,803) s(j),b(j) 23 continue if (left .eq. 0) go to 99 print 122, left,auxleft 122 format (i5,' unmatched stations in the supplementary file were', 1 ' stored in file:',/,4x,a65) print 123, (s(j),j=1,left) 123 format (8(1x,a8)) 99 close (7) close (8) close (9) if (left .ne. 0) close (10) if (ifrec .eq. 1) close (17) stop end