      subroutine delete (idx,ndx,icomp)                                 DELE001
c ----------------------------------------------------------------------DELE002
c     deletes a data base entry SEXIE.DBF via SEXIE.IDX                 DELE003
c ----------------------------------------------------------------------DELE004
c     This program module is part of the PhysiSoft X-ray Library        DELE005
c     and may not be sold or reproduced for commercial purposes.        DELE006
c     Although it has been tested carefully, there is no warranty       DELE007
c     regarding accuracy or freedom from side-effects.                  DELE008
c                   (C) 1986-1990 Bernhard Rupp                         DELE009
c ----------------------------------------------------------------------DELE010
                                                                        DELE011
      parameter (iat=20,iidx=3200)                                      DELE012
                                                                        DELE013
      character answ,title*60,dbname*8,nlbl*8,icomp*4                   DELE014
      integer idx (iidx)                                                DELE015
c     logical exists                                                    DELE016
   22 format (a60)                                                      DELE017
      ipr=6                                                             DELE018
      ilines=0                                                          DELE019
      ifi=0                                                             DELE020
 0001 write (ipr,'(/a$)')'  Enter the label of the entry to be deleted :DELE021
     & '                                                                DELE022
      read (*,'(a8)') dbname                                            DELE023
      call upstrg(dbname,8)                                             DELE024
      if(dbname.eq.' ') goto 0001                                       DELE025
      call clrscr (icomp)                                               DELE026
      print*,' Searching........'                                       DELE027
      do 0005 i=1,ndx                                                   DELE028
         if (idx(i).gt.0) then                                          DELE029
            irec=idx(i)                                                 DELE030
            read(1,'(2x,a8)',rec=irec) nlbl                             DELE031
            if (dbname.eq.nlbl) then                                    DELE032
               if (i.lt.ndx) then                                       DELE033
                  iend=iabs(idx(i+1))-idx(i)                            DELE034
               else                                                     DELE035
                  iend=iat+11                                           DELE036
               end if                                                   DELE037
               do 0003 j=idx(i), idx(i)+iend-1                          DELE038
                  read(1,22,rec=j,err=0007) title                       DELE039
                  write(ipr,*) title                                    DELE040
                  ilines=ilines+1                                       DELE041
                  if (mod(ilines,21).eq.0) then                         DELE042
                     write(ipr,'(a$)') '  Hit enter for more '          DELE043
                     call inkey(answ)                                   DELE044
                     ilines=0                                           DELE045
                  end if                                                DELE046
                  ifi=1                                                 DELE047
 0003          continue                                                 DELE048
               goto 0007                                                DELE049
            end if                                                      DELE050
         end if                                                         DELE051
 0005 continue                                                          DELE052
      if (ifi.eq.0) then                                                DELE053
          print*,' Search string not found - ',dbname                   DELE054
          print*,' Hit enter to continue '                              DELE055
          call inkey (answ)                                             DELE056
          call clrscr (icomp)                                           DELE057
          return                                                        DELE058
      end if                                                            DELE059
 0007 write(ipr,'(a$)') '  Really delete this entry (Y/N) : '           DELE060
      call inkey(answ)                                                  DELE061
      if (answ.ne.'Y') then                                             DELE062
         call clrscr (icomp)                                            DELE063
         return                                                         DELE064
      else                                                              DELE065
         idx(i)=-idx(i)                                                 DELE066
         write(2,'(i6)',rec=i) idx(i)                                   DELE067
         call clrscr (icomp)                                            DELE068
         return                                                         DELE069
      end if                                                            DELE070
      end                                                               DELE071
