      subroutine retriv (idx,ndx,ili,iptr,il,ierr,icomp)                RETR001
c ----------------------------------------------------------------------RETR002
c     retrieves entry with label DBNAME in SEXIE.DBF via SEXIE.IDX      RETR003
c ----------------------------------------------------------------------RETR004
c     This program module is part of the PhysiSoft X-ray Library        RETR005
c     and may not be sold or reproduced for commercial purposes.        RETR006
c     Although it has been tested carefully, there is no warranty       RETR007
c     regarding accuracy or freedom from side-effects.                  RETR008
c                   (C) 1986-1990 Bernhard Rupp                         RETR009
c ----------------------------------------------------------------------RETR010
                                                                        RETR011
      parameter (iat=20,iidx=3200)                                      RETR012
                                                                        RETR013
      character answ,dbname*8,nlbl*8,ili*60,icomp*4                     RETR014
      integer idx (iidx)                                                RETR015
      dimension ili(5+iat)                                              RETR016
                                                                        RETR017
   22 format (a60)                                                      RETR018
      ipr=6                                                             RETR019
      ilines=0                                                          RETR020
      ifi=0                                                             RETR021
 0001 write (ipr,'(/a$)')'  Enter the label of entry to be retrieved : 'RETR022
      read (*,'(a8)') dbname                                            RETR023
      call upstrg(dbname,8)                                             RETR024
      if(dbname.eq.' ') goto 0001                                       RETR025
      call clrscr (icomp)                                               RETR026
      print*,' Searching........'                                       RETR027
      do 0005 i=1,ndx                                                   RETR028
         if (idx(i).gt.0) then                                          RETR029
            irec=idx(i)                                                 RETR030
            read(1,'(2x,a8)',rec=irec) nlbl                             RETR031
            if (dbname.eq.nlbl) then                                    RETR032
               iptr=i                                                   RETR033
               if (i.eq.ndx) then                                       RETR034
                  do 0006 j=0,4+iat                                     RETR035
                     irec=idx(i)+j                                      RETR036
                     read (1,22,rec=irec,err=0096) ili(j+1)             RETR037
 0006             continue                                              RETR038
 0096             continue                                              RETR039
                  il=j                                                  RETR040
               else                                                     RETR041
                  il=iabs(idx(i+1))-idx(i)                              RETR042
                  do 0007 j=0,il-1                                      RETR043
                     irec=idx(i)+j                                      RETR044
                     read (1,22,rec=irec) ili(j+1)                      RETR045
 0007             continue                                              RETR046
               end if                                                   RETR047
               goto 0009                                                RETR048
            end if                                                      RETR049
         end if                                                         RETR050
 0005 continue                                                          RETR051
      write (ipr,'(/a,a)')'  Unable to find entry label ',dbname        RETR052
      write (ipr,'(a)')   '  Hit enter to return to data base menu'     RETR053
      call inkey (answ)                                                 RETR054
      ierr=1                                                            RETR055
      return                                                            RETR056
 0009 ierr=0                                                            RETR057
      return                                                            RETR058
      end                                                               RETR059
