      subroutine append (subfld, field, lfield)

c appends 'subfld' to 'field' starting at offset 'lfield' + 1
c if 'lfield' is zero then remainder of field will be set to spaces.

      character*(*) subfld, field
      character*6 chival

      last = lfield + len(subfld)
      if (last .gt. len(field)) then
        call logit (field)
        call logit (subfld)
        call abort ('Append: field too long'//chival(last)
     2           //' exceeds'//chival(len(field)))
        last = len(field)
      end if
      if (lfield .gt. 0) then
        if (lfield .lt. last) field(lfield+1:last) = subfld
      else if (lfield .eq. 0) then
        field = subfld
      else
        call abort ('Bad call to append: lfield set to '
     2               //chival(lfield))
      end if
      lfield = last
      return
      end
