      logical function getqul (key, file, maxch)
      integer maxch
      integer*2 key(*)
      integer*2 file(*)
      integer*2 refkey(63+1,2)
      integer*2 qualky(63+1,2)
      integer len
      integer icode
      integer iword
      logical Memb(1)
      integer*2 Memc(1)
      integer*2 Mems(1)
      integer Memi(1)
      integer*4 Meml(1)
      real Memr(1)
      double precision Memd(1)
      complex Memx(1)
      equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx)
      common /Mem/ Memd
      integer sp
      integer root
      integer ext
      logical isrefe
      integer fnroot
      integer fnextn
      integer xstrln
      integer stridx
      integer wordmh
      integer*2 codesr(3)
      integer*2 urefs(36)
      integer*2 uqual(36)
      integer*2 wrefs(54)
      integer*2 wqual(54)
      equivalence (refkey(1,1), urefs)
      equivalence (refkey(1,2), wrefs)
      equivalence (qualky(1,1), uqual)
      equivalence (qualky(1,2), wqual)
      integer*2 st0001(6)
      save
      integer iyy
      data codesr /117,119, 0/
      data (urefs(iyy),iyy= 1, 8) / 98,108,101,118,102,105,108,101/
      data (urefs(iyy),iyy= 9,16) / 44, 98,105, 97,115,102,105,108/
      data (urefs(iyy),iyy=17,24) /101, 44,100, 97,114,107,102,105/
      data (urefs(iyy),iyy=25,32) /108,101, 44,102,108, 97,116,102/
      data (urefs(iyy),iyy=33,36) /105,108,101, 0/
      data (uqual(iyy),iyy= 1, 8) / 98,108,101,118,100,102,105,108/
      data (uqual(iyy),iyy= 9,16) / 44, 98,105, 97,115,100,102,105/
      data (uqual(iyy),iyy=17,24) /108, 44,100, 97,114,107,100,102/
      data (uqual(iyy),iyy=25,32) /105,108, 44,102,108, 97,116,100/
      data (uqual(iyy),iyy=33,36) /102,105,108, 0/
      data (wrefs(iyy),iyy= 1, 8) / 98,108,101,118,102,105,108,101/
      data (wrefs(iyy),iyy= 9,16) / 44, 98,105, 97,115,102,105,108/
      data (wrefs(iyy),iyy=17,24) /101, 44,112,114,101,102,102,105/
      data (wrefs(iyy),iyy=25,32) /108,101, 44,112,117,114,103,102/
      data (wrefs(iyy),iyy=33,40) /105,108,101, 44,100, 97,114,107/
      data (wrefs(iyy),iyy=41,48) /102,105,108,101, 44,102,108, 97/
      data (wrefs(iyy),iyy=49,54) /116,102,105,108,101, 0/
      data (wqual(iyy),iyy= 1, 8) / 98,108,101,118,100,102,105,108/
      data (wqual(iyy),iyy= 9,16) / 44, 98,105, 97,115,100,102,105/
      data (wqual(iyy),iyy=17,24) /108, 44,112,114,101,102,100,102/
      data (wqual(iyy),iyy=25,32) /105,108, 44,112,117,114,103,100/
      data (wqual(iyy),iyy=33,40) /102,105,108, 44,100, 97,114,107/
      data (wqual(iyy),iyy=41,48) /100,102,105,108, 44,102,108, 97/
      data (wqual(iyy),iyy=49,54) /116,100,102,105,108, 0/
      data st0001 / 37,115, 46, 37,115, 0/
         call smark (sp)
         call salloc (root, 255 , 2)
         call salloc (ext, 255 , 2)
         if (.not.(.not. isrefe (file))) goto 110
            icode = 0
            goto 111
110      continue
         if (.not.(fnroot (file, memc(root), 255 ) .eq. 0)) goto 120
            icode = 0
            goto 121
120      continue
         if (.not.(fnextn (file, memc(ext), 255 ) .eq. 0)) goto 130
            icode = 0
            goto 131
130      continue
            len = xstrln(memc(root))
            icode = stridx (memc(root+len-1), codesr)
131      continue
121      continue
111      continue
         if (.not.(icode .eq. 0)) goto 140
            iword = 0
            goto 141
140      continue
            iword = wordmh (key, refkey(1,icode))
            if (.not.(iword .gt. 0)) goto 150
               call wordfd (iword, qualky(1,icode), key, maxch)
               memc(ext) = 98
               call sprinf (file, maxch, st0001)
               call pargsr (memc(root))
               call pargsr (memc(ext))
150         continue
141      continue
         call sfree (sp)
         getqul = (iword .gt. 0)
         goto 100
100      return
      end
c     sprinf  sprintf
c     wordfd  word_find
c     isrefe  is_reffile
c     getqul  getqual
c     codesr  codestr
c     wordmh  word_match
c     qualky  qualkey
c     pargsr  pargstr
