SUBROUTINE next_l2 (success) c--------------------------------------------------------------------------- c CALLING PARAMETERS LOGICAL success c--------------------------------------------------------------------------- c COMMON BLOCKS INCLUDE 'ovpindex.prm' INCLUDE 'ovpindex.cmn' INCLUDE 'tomsframe.cmn' c--------------------------------------------------------------------------- c LOCAL VARIABLES LOGICAL extant CHARACTER*20 instdir /'InstData'/ c=========================================================================== IF(debuglevel .GT. 8) WRITE(6,*)'> SUBROUTINE next_l2' success=.TRUE. c-- read in the next record CALL rdrec7(lun_l2) c-- if it's an orbit trailer, read in the next record IF(seq .LT. 0) THEN CALL rdrec7(lun_l2) c-- If this one is the file trailer, see if the next file in sequence c-- is available. If necessary, scroll forward until we have the next file. IF(seq .EQ. -1) THEN c write(6,*)'..next_l2 -- new file' CLOSE(lun_l2) 100 CONTINUE c-- If we're on the last file, set the_end and return write(6,'(A7,2x,a7)')yeardoy, yeardoy_final IF(yeardoy .EQ. yeardoy_final) THEN success=.FALSE. RETURN END IF c-- ... otherwise, find the next file in sequence ... CALL yyyydoy_inc(yeardoy) c-- Make sure we have the current instrument data for the new day CALL ld_instdata(sat2lc, yeardoy, instdir, success) IF(.NOT.success) GOTO 100 file_l2(15:18)= yeardoy(1:4) file_l2(21:25)= yeardoy(3:7) c write(6,'(A)')file_l2 INQUIRE(file=file_l2, exist=extant) IF(.NOT. extant) GOTO 100 c-- ... and open it and get the first data record.. WRITE(6,'(A50)') file_l2 OPEN(UNIT=lun_l2, & FILE= file_l2, & FORM='unformatted', & STATUS='old', & READONLY) recno=0 CALL rdrec7(lun_l2) CALL rdrec7(lun_l2) END IF END IF IF(debuglevel .GT. 8) WRITE(6,*)'< SUBROUTINE next_l2' RETURN END