subroutine sta_name m (iscnt,stid,station_code,moveto) c c + + + PURPOSE + + + c Choose a State (istate) and display the available climate stations c for the State selected. c c ----- Split out from the STA_DAT module 9/27/99 by C. R. Meyer. c c + + + ARGUMENT DECLARATIONS + + + integer iscnt,station_code,moveto character*41 stid c c + + + ARGUMENT DEFINITIONS + + + c istate - Numeric Climate Code of Desired State. c index - 4-digit numeric station index. c iscnt - Number of Stations in Selected State. c stid - ASCII Station Name. c station_code - 4-digit Numeric Station Code. c moveto - A global flag. If set to 'XX' it means "goto XX". c c + + + COMMON BLOCKS + + + include 'command.inc' c c + + + LOCAL VARIABLES + + + integer ndflag integer kknt integer state_code, nst integer lat, long !? LEW c -- XXX -- COUNTY is supposed to be read & written, but space is never c allocated to _store_ it! Added stmt below. CRM -- 9/27/99. character*20 county character*1 yc c c + + + LOCAL DEFINITIONS + + + c yc - 1-character user response (y/n). c c + + + INPUT FORMATS + + + 1000 format(i2) 1010 format(a41,i2) 1020 format(a41,i2,i4,i3,i4,a20) c c + + + OUTPUT FORMATS + + + 2000 format(1x,'State Climate Code - Available Stations'/) 2010 format(1x,'01 Alabama 20 Michigan 39 S. Dakota', 1/1x,'02 Arizona 21 Minnesota 40 Tennessee', 2/1x,'03 Arkansas 22 Mississippi 41 Texas', 3/1x,'04 California 23 Missouri 42 Utah', 4/1x,'05 Colorado 24 Montana 43 Vermont', 5/1x,'06 Connecticut 25 Nebraska 44 Virginia', 6/1x,'07 Delaware 26 Nevada 45 Washington', 7/1x,'08 Florida 27 New Hampshire 46 West Virginia', 8/1x,'09 Georgia 28 New Jersey 47 Wisconsin', 9/1x,'10 Idaho 29 New Mexico 48 Wyoming') 2020 format(1x,'11 Illinois 30 New York 49 Washington DC', 1/1x,'12 Indiana 31 North Carolina 50 Alaska', 2/1x,'13 Iowa 32 North Dakota 51 Hawaii', 3/1x,'14 Kansas 33 Ohio 66 Puerto Rico', 4/1x,'15 Kentucky 34 Oklahoma 91 Pacific Islands', 5/1x,'16 Louisiana 35 Oregon 99 Interpolated File', 6/1x,'17 Maine 36 Pennsylvania ', 7/1x,'18 Maryland 37 Rhode Island ', 8/1x,'19 Massachusetts 38 South Carolina ') 2030 format(/1x,'Enter state climate code (ex. 01 for Alabama): ') c2040 format(/1x,'Stations Available',19x,' Station No. ', 2040 format(/1x,'Stations Available',18x,' Station No. ', 1 'Lat. Long County'/, c 11x,8('-'),1x,9('-'),19x,17('-'),2x,4('-'),1x,7('-')/) 11x,8('-'),1x,9('-'),18x,17('-'),2x,4('-'),1x,7('-')/) c2050 format(1x,a41,2x,i4,3x,i3,2x,i4,1x,a19) 2050 format(1x,a41,1x,i4,3x,i3,2x,i4,1x,a19) c c + + + END SPECIFICATIONS + + + c c ---- Determine Desired State c --- (skip, if state is a command line arg.) cc if(istate.le.0) then 10 continue write(*,2000) write(*,2010) write(*,2020) write(*,2030) ndflag = 15 read(*,1000,err=15)istate ndflag = 0 15 continue if(ndflag .eq. 15) then write(*,*)' Error Entering State Code ' write(*,*) write(*,*)' Press Enter to Continue' read(*,'(a1)')yc endif if(ndflag .ne. 0) goto 10 cc endif c c ---- Interpolated File moveto = 0 if(istate.eq.99) then iscnt = 1 c iyr = 0 moveto = 50 end if c if(moveto.ne.50 .and. index.le.0) then c c ------ Read List of Available Stations c -- istate -- Numeric Climate Code of Desired State c -- kknt -- Lines Displayed on Screen so far c -- state_code -- Numeric State Code c -- nst -- Numeric State Code (same) c open(11,file='stations',status='old') rewind (11) iscnt=0 c iyr=0 write(*,2040) kknt=0 20 continue ndflag =29 read(11,1010,end=29)stid,state_code if(state_code.eq.istate) then kknt=kknt+1 iscnt=iscnt+1 backspace(11) read(11,1020)stid,nst,station_code,lat,long,county if(kknt.gt.20) then kknt=0 write(*,*) 'Press "ENTER" to continue.' read(*,'(a1)') yc endif write(*,2050)stid,station_code,lat,long,county endif ndflag = 0 29 continue if(ndflag.eq.0 .and. state_code.le.istate) goto 20 endif c close (11) return end