      subroutine uphear (im, keywod, value, oper, verify)
      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 im
      logical verify
      integer*2 keywod(*)
      integer*2 value(*)
      integer*2 oper(*)
      logical found
      logical update
      integer code
      integer sp
      integer key
      integer val
      integer oldval
      integer newval
      integer errmsg
      logical clgetb
      logical checkq
      logical getqul
      integer strdic
      logical xerpop
      logical xerflg
      common /xercom/ xerflg
      integer*2 oplist(23)
      integer*2 badopr(23)
      integer*2 asknol(55)
      integer*2 askisl(50)
      integer*2 st0001(7)
      integer*2 st0002(7)
      save
      integer iyy
      data (oplist(iyy),iyy= 1, 8) /124,105,110,115,101,114,116,124/
      data (oplist(iyy),iyy= 9,16) /117,112,100, 97,116,101,124,100/
      data (oplist(iyy),iyy=17,23) /101,108,101,116,101,124, 0/
      data (badopr(iyy),iyy= 1, 8) / 85,110,107,110,111,119,110, 32/
      data (badopr(iyy),iyy= 9,16) /111,112,101,114, 97,116,105,111/
      data (badopr(iyy),iyy=17,23) /110, 32, 40, 37,115, 41, 0/
      data (asknol(iyy),iyy= 1, 8) / 10, 79,108,100, 32,118, 97,108/
      data (asknol(iyy),iyy= 9,16) /117,101, 32,111,102, 32, 37,115/
      data (asknol(iyy),iyy=17,24) / 46, 37,115, 32,110,111,116, 32/
      data (asknol(iyy),iyy=25,32) /102,111,117,110,100, 10, 78,101/
      data (asknol(iyy),iyy=33,40) /119, 32,118, 97,108,117,101, 32/
      data (asknol(iyy),iyy=41,48) /111,102, 32, 37,115, 46, 37,115/
      data (asknol(iyy),iyy=49,55) / 32, 61, 32, 37,115, 10, 0/
      data (askisl(iyy),iyy= 1, 8) / 10, 79,108,100, 32,118, 97,108/
      data (askisl(iyy),iyy= 9,16) /117,101, 32,111,102, 32, 37,115/
      data (askisl(iyy),iyy=17,24) / 46, 37,115, 32, 61, 32, 37,115/
      data (askisl(iyy),iyy=25,32) / 10, 78,101,119, 32,118, 97,108/
      data (askisl(iyy),iyy=33,40) /117,101, 32,111,102, 32, 37,115/
      data (askisl(iyy),iyy=41,48) / 46, 37,115, 32, 61, 32, 37,115/
      data (askisl(iyy),iyy=49,50) / 10, 0/
      data st0001 /117,112,100, 97,116,101, 0/
      data st0002 /117,112,100, 97,116,101, 0/
         call smark (sp)
         call salloc (key, 255 , 2)
         call salloc (val, 255 , 2)
         call salloc (newval, 255 , 2)
         call salloc (oldval, 255 , 2)
         call salloc (errmsg, 1023 , 2)
         code = strdic (oper, memc(val), 255 , oplist)
         if (.not.(code .eq. 0)) goto 110
            call sprinf (memc(errmsg), 1023 , badopr)
            call pargsr (oper)
            call xerror(1, memc(errmsg))
            if (xerflg) goto 100
110      continue
         call xstrcy(keywod, memc(key), 255 )
         call xstrcy(value, memc(val), 255 )
120      continue
            call addrer (memc(val), memc(newval), 255 )
            call xerpsh
            found = .true.
            call imgstr (im, memc(key), memc(oldval), 255 )
132         if (.not.xerpop()) goto 130
               found = .false.
               memc(oldval) = 0
130         continue
            if (.not.(found)) goto 140
               update = .not. checkq (memc(oldval), memc(newval))
               goto 141
140         continue
               update = (code .eq. 1)
141         continue
            if (.not.(update .and. verify)) goto 150
               call clputb (st0001, .true.)
               if (.not.(found)) goto 160
                  call eprinf (askisl)
                  call pargsr (memc((((im+200 +165)-1)*2+1)) )
                  call pargsr (memc(key))
                  call pargsr (memc(oldval))
                  call pargsr (memc((((im+200 +165)-1)*2+1)) )
                  call pargsr (memc(key))
                  call pargsr (memc(newval))
                  goto 161
160            continue
                  call eprinf (asknol)
                  call pargsr (memc((((im+200 +165)-1)*2+1)) )
                  call pargsr (memc(key))
                  call pargsr (memc((((im+200 +165)-1)*2+1)) )
                  call pargsr (memc(key))
                  call pargsr (memc(newval))
161            continue
               update = clgetb (st0002)
150         continue
            if (.not.(update)) goto 170
               if (.not.(code .eq. 3)) goto 180
                  call imdelf (im, memc(key))
                  goto 181
180            continue
                  call imastr (im, memc(key), memc(newval))
181            continue
170         continue
121         if (.not.(.not. getqul (memc(key), memc(val), 255 ))) goto 
     *      120
122      continue
         call sfree (sp)
100      return
      end
c     sprinf  sprintf
c     checkq  check_eq
c     badopr  badoper
c     askisl  askisval
c     asknol  asknoval
c     getqul  getqual
c     uphear  upheader
c     eprinf  eprintf
c     addrer  addrefdir
c     pargsr  pargstr
c     keywod  keyword
