anchor.diff:        COMMON /DVARS/ yr1,mo1,yr2,mo2,dy1,dy2,ndy
         !print *,'IFMT',ifmt
         if (ifmt.eq.1) then
  -          read(arg,*) arg1,arg2
  -          read(arg1(1:4),*) yr1
  -          read(arg1(5:6),*) mo1
  -          read(arg1(7:8),*) dy1
  +          read(arg,*,err=9001,iostat=ios) arg1,arg2
  +          read(arg1(1:4),*,err=9001,iostat=ios) yr1
  +          read(arg1(5:6),*,err=9001,iostat=ios) mo1
  +          read(arg1(7:8),*,err=9001,iostat=ios) dy1
             if (long.eq.1) then
  -              read(arg1(9:10),*) hr1
  -              read(arg1(11:12),*) mn1
  -              read(arg1(13:14),*) sc1
  +              read(arg1(9:10),*,err=9001,iostat=ios) hr1
  +              read(arg1(11:12),*,err=9001,iostat=ios) mn1
  +              read(arg1(13:14),*,err=9001,iostat=ios) sc1
             endif
             if (opt.eq.1.or.opt.eq.3) then
  -              read(arg2(1:4),*) yr2
  -              read(arg2(5:6),*) mo2
  -              read(arg2(7:8),*) dy2
  +              read(arg2(1:4),*,err=9001,iostat=ios) yr2
  +              read(arg2(5:6),*,err=9001,iostat=ios) mo2
  +              read(arg2(7:8),*,err=9001,iostat=ios) dy2
                 if (long.eq.1) then
  -                  read(arg2(9:10),*) hr2
  -                  read(arg2(11:12),*) mn2
  -                  read(arg2(13:14),*) sc2
  +                  read(arg2(9:10),*,err=9001,iostat=ios) hr2
  +                  read(arg2(11:12),*,err=9001,iostat=ios) mn2
  +                  read(arg2(13:14),*,err=9001,iostat=ios) sc2
                 endif
             else
  -              read(arg2,*) ndy
  +              read(arg2,*,err=9001,iostat=ios) ndy
  +          endif
  + 9001     if (ios.ne.0) then
  +              write(0,*) '!! Offending line: ',trim(arg)
  +              call usage('!! Error reading date1 date2|nday'//
  +     1         ' with date format YYYYMMDD[HHMMSS]')
             endif
         elseif (ifmt.eq.2) then
             if (long.eq.0.and.opt.eq.1.or.opt.eq.3) then
  
positive.code:               read(arg,*,end=2001) yr1,mo1,dy1,hr1,mn1,sc1,ndy
            endif
        elseif (ifmt.eq.3) then
            read(arg,*) arg1,arg2
            read(arg1(1:4),*) yr1
            read(arg1(6:7),*) mo1
            read(arg1(9:10),*) dy1
            if (long.eq.1) then
                read(arg1(12:13),*) hr1
                read(arg1(15:16),*) mn1
                read(arg1(18:19),*) sc1
            endif
            if (opt.eq.1.or.opt.eq.3) then
                read(arg2(1:4),*) yr2
                read(arg2(6:7),*) mo2
                read(arg2(9:10),*) dy2    
                if (long.eq.1) then
                    read(arg2(12:13),*) hr2
                    read(arg2(15:16),*) mn2
                    read(arg2(18:19),*) sc2
                endif
            else
                read(arg2,*) ndy
            endif
        endif
        if (opt.eq.1.or.opt.eq.3.and.long.eq.1) then
  
negative.code:       SUBROUTINE rdarg(arg,ifmt,opt,long)
        IMPLICIT none
        CHARACTER*240 arg,arg1,arg2
        INTEGER ios
        INTEGER opt,long,ifmt
        INTEGER yr1,mo1,yr2,mo2
        REAL*8 dy1,dy2,ndy
  