logical function checkdates ( dates, ndates, ierror, & xdates ) C C return value: True = all dates are in order, false, out of order C ierror = line where error occurred; random if all dates are in order C xdates = array of real*8 dates in ch2sec format, if everything is OK C integer ndates, ierror character*25 dates(ndates), sec2ch, tnew double precision ch2sec, t, tlast, xdates(ndates) external ch2sec, sec2ch logical error, result data result/.true./ tlast = ch2sec ( dates(1), .true., error) tnew = sec2ch ( tlast ) dates (1) = tnew xdates(1) = tlast do i=2, ndates t = ch2sec ( dates(i), .true., error) xdates(i) = t tnew = sec2ch ( t ) dates (i) = tnew if (t .lt. tlast) then result = .false. ierror = i goto 9999 else tlast = t end if end do 9999 continue checkdates = result return end C program tester C logical checkdates C character*25 dates(11) C data dates / '16-APR-1992 23:30', C & '19-APR-1992 15:12', '13-MAY-1992 01:48', '18-JUN-1992 22:20', C & '27-JUL-1992 14:20', '29-AUG-1993 15:03', '2-SEP-1993 03:01', C & '6-OCT-1993 04:27', '11-NOV-1993 19:22', '12-DEC-1993 08:29', C & '13-MAY-1994 05:06'/ C data dates / '16-APR-1992 23:30', C & '19-APR-1992 15:12', '13-MAY-1992 01:48', '18-JUN-1992 22:20', C & '27-JUL-1992 14:20', '29-AUG-1993 15:03', '2-SEP-1993 03:01', C & '6-OCT-1993 04:27', '11-NOV-1992 19:22', '12-DEC-1993 08:29', C & '13-MAY-1994 05:06'/ C write(6,*) checkdates(dates, 11, ierror), ' ', ierror C stop C end