dimension iter(3000) character map*4,thismap*4,nextmap*4,infile*65,outfile*65 character*8 sta,nextsta,s(3000),ans*1 logical exists data n,line/2*0/ print 100 100 format (' Plouff, 11-94, PREPHTC. Interactively prepares a', 1 ' file of station names',/,' and associated hand TC''s for ', 2 'input into program ADDTC, which updates plouff',/,' file. ', 3 'The input into this program is the (sorted) output from pro', 4 'gram ',/,' MAPINDEX. You could either type TC''s directly ', 5 'from a map or refer to a',/,' list, for example, superim', 6 'posed on output from program MAPSTAS.') inquire (file='PREPHTC.PNT',exist=exists) if (exists) then print 101 101 format (' You already have file PREPHTC.PNT that records ', 1 'this program.',/,' DO YOU WANT TO STOP TO SAVE THE FILE?') read 501, ans 501 format (a1) if (ans .eq. 'y' .or. ans .eq. 'Y' .or. ans .eq. ' ') stop end if print 102 102 format (' TYPE the name of the output file from MAPINDEX:') read 565, infile 565 format (a65) inquire (file=infile,exist=exists) if (.not. exists) then print 103 103 format (' That file was not found. Try once more.') print 102 read 565, infile inquire (file=infile,exist=exists) if (.not. exists) then print 104 104 format (' **STOP. Input file again was not found.') stop end if end if print 105 105 format (' TYPE a name for an output file of TC''s to be sub', 1 'mitted to the ADDTC program:') read 565, outfile inquire (file=outfile,exist=exists) if (exists) then print 106 106 format (' That output file already exists. Do you want to ', 1 'STOP to save it?') read 501, ans if (ans .eq. 'y' .or. ans .eq. 'Y' .or. ans .eq. ' ') stop end if open (15,file=infile,form='formatted',status='old') open (16,file='PREPHTC.PNT',form='formatted',status='unknown') write (16,100) open (7,file=outfile,form='formatted',status='unknown') write (16,201) infile,outfile 201 format (' Your MAPINDEX file for input is:',/,3x,a65,/, 1 ' Your output file of estimated TC''s is:',/,3x,a65) print 107 107 format (' Type TC''s in response to a prompt of a ', 1 'map name followed by station name.',/,' Typing a zero means', 2 ' to skip that station. Typing a negative number means',/, 3 ' to select following options to stop or to skip ahead:',/, 4 ' 1--Skip to a station name to be typed',/,' 2--', 5 'Skip to next map after this one',/,' 3--Skip to next map ', 6 'name to be typed',/,' 4--Stop process (can append ', 7 'later)',/,' Type hand TC''s in units of 0.01 mGal without ', 8 'a decimal point.') 50 read (15,150,end=9) map,sta 150 format (2x,a4,1x,a8) line=line+1 c Skip " MAP" header at beginning or end of file or original filename. if (map .eq. ' MAP' .or. map .eq. 'Inpu') go to 50 51 print 108, sta,map 108 format (1x,a8,' (',a4,'):') read (5,*,err=8) itc if (itc) 52,50,53 c Negative number for TC; await further instruction. 52 print 109 109 format (' TYPE 1 (next sta #), 2 (go to next map), 3 (skip to ', 1 'later map), or 4 (stop):') read (5,*,err=88) itype if (itype .lt. 1 .or. itype .gt. 4) go to 88 go to (1,2,3,4), itype 1 print 110 110 format (' TYPE next 8-digit station name you want to skip to:') read 508, nextsta 508 format (a8) 11 read (15,150,end=19) map,sta line=line+1 if (sta .eq. nextsta) go to 51 go to 11 19 print 619, sta write (16,619) sta 619 format (' ***Premature stop. Station ',a8,' was not found.') go to 9 2 thismap=map 21 read (15,150,end=29) map,sta line=line+1 if (map .ne. thismap) go to 51 go to 21 29 print 629, map write (16,629) map 629 format (' ***Premature stop. No more maps were after ',a4) go to 9 3 print 111 111 format (' TYPE next 4-digit map name you want to skip to:') read 504, nextmap 504 format (a4) 31 read (15,150,end=39) map,sta line=line+1 if (map .eq. nextmap) go to 51 go to 31 39 print 639, nextmap,map write (16,639) nextmap,map 639 format (' ***Premature stop. Requested map ',a4,' was not in ', 1 'the file after map ',a4) go to 9 4 write (16,649) map,sta 649 format (' ***You stopped input after map ',a4,', station ',a8) go to 9 c Positive acceptable number for TC 53 write (7,700) sta,itc 700 format (a8,i4) n=n+1 s(n)=sta iter(n)=itc if (n .eq. 3000) then print 160, sta write (16,160) sta 160 format (' Wow! You hit the limit of 3000 TC''s with station ', 1 a8,/,' Take a break and start over where you must stop now.') go to 9 end if go to 50 8 print 800 800 format (' You typed something that was not an integer number. ', 1 'Try again.') go to 51 88 print 801 801 format (' You typed an unacceptable response. Try again.') go to 52 9 print 609, n,outfile write (16,609) n,outfile 609 format (' A total of',i4,' stations were provided TC''s in ', 1 'file:',/,3x,a65) print 902 902 format (' Print file PREPHTC.PNT to see a record of the ', 1 'updated stations.',/,' To optimize merging with ', 2 'plouff file, sort PREPHTC output files.') if (n .eq. 0) then print 699 write (16,699) 699 format (' ***NO stations were updated') go to 99 end if write (16,900) 900 format (6(' STATION HTC')) write (16,901) (s(i),iter(i),i=1,n) 901 format (6(1x,a8,i4)) 99 close (16) close (15) close (7) stop end