      logical function choose (finish)

      logical finish

      include 'basics.inc'

      include 'hold.inc'

c decide whether event is to be included

      character*14 timval, timold/' '/
      
      character*7 recs7
      character*8 recs8
      character*14 recs14

c Sept 8th 2003 - locprm is now the prime's record no in the
c Direct Access temp file      

c      timval = recs(locprm)(5:18)

      timval = recs14(locprm,5,18)

      call exchange (timval, ' ', '0')
      if (timval .lt. timold) then
        call abort ('Time sequence error: '//timold//timval)
      else
        timold = timval
      end if
      
c      write (*,'(a)') '+searching '//timval(:4)//'/'//timval(5:6)
c     2         //'/'//timval(7:8)

      finish = timval .gt. timlim(2)
      choose = timval .ge. timlim(1) .and. .not.finish
      
      if (choose) then

   
c        rlat = itch(recs(locprm)(27:33), ier) * .0001
c        if (ier .ne. 7)
c     2         call abort ('Bad latitude in'//recs(locprm)(27:33))
     
        rlat = itch(recs7(locprm,27,33), ier) * .0001
        
        if (ier .ne. 7)
     2         call abort ('Bad latitude in'//recs7(locprm,27,33))     
     
        choose = rlat .ge. elalim(1) .and. rlat .le. elalim(2)
        
        if (choose) then
        
c          rlon = itch(recs(locprm)(36:43), ier) * .0001
c          if (ier .ne. 8)
c     2       call abort ('Bad longitude in'//recs(locprm)(36:43))
     
          rlon = itch(recs8(locprm,36,43), ier) * .0001
          if (ier .ne. 8)
     2       call abort ('Bad longitude in'//recs8(locprm,36,43))    
     
          if (elolim(1) .lt. elolim(2)) then
            choose = rlon .ge. elolim(1) .and. rlon .le. elolim(2)
          else if (elolim(1) .gt. elolim(2)) then
            choose = rlon .ge. elolim(1) .or. rlon .le. elolim(2)
          else
            choose = rlon .eq. elolim(1)
          end if
        end if
      end if
      return
      end
