      subroutine HELP(OPTION)
      include 'SIZE.INC'
      include 'INPAR.INC'
      include 'MODNAM.INC'
      include 'UNITS.INC'
      include 'HELPER.INC'
      integer IBUFF(VARIEC), OPTION, IPRT
      integer HELEN(MAXHLP), INUNIT, MINHLP(MAXHLP), EOF
      integer RECDAT(FILDAT), HRECS
      integer NEXT,M,I,L,INSAVE,IMBED,INDX,IN,NOHELP,NN,MATCH,N1,N2
      integer LENT,J,IM,II,IOFF,NCHAR,K
      character*1 CBUFF(VARCEC),HELPS(MAXINI),BLANK,CIM,BUFFER(VARCEC)
      character TEMP*4, REQFMT*42
      data REQFMT/'(/1X,''Enter name of input parameter-> ''  )'/
      data BLANK/' '/
      INUNIT = TTYIN(MACHNO)
      call READSP
      IPRT = 0
      NEXT = 0
      HRECS = FILDAT/VARIEC
      if (FILDAT-VARIEC*HRECS.ne.0) HRECS = HRECS+1
      M = 0
      do 110 I = 1, HRECS
         read (RANUNT(MACHNO),rec=I) IBUFF
         do 100 L = 1, VARIEC
            M = M+1
            if (M.gt.FILDAT) go to 120
            RECDAT(M) = IBUFF(L)
100      continue
110   continue
120   continue
      INSAVE = RECDAT(3)-1
130   continue
      START = IMBED(INPUT,STOPIT)
      if (START.ne.-999) go to 140
      INDX = 1
      if (OPTION.eq.0) go to 190
      REQFMT(40:41) = CRSTOP(MACHNO)
      write (TTYOUT(MACHNO),REQFMT)
      call INREC (EOF,INUNIT,INPUT)
      if (EOF.eq.1) go to 220
      STOPIT = 0
      go to 130
140   continue
      call SKAN (INPUT,START,STOPIT,TYPE,BLANK,1)
      if (TYPE.eq.100) STOPIT = 81
      if (OPTION.eq.1) go to 170
      IN = RECDAT(1)-1
      call UNPREC(IN,HELEN,NOHELP,MAXHLP)
      call UNPREC(IN,MINHLP,NOHELP,MAXHLP)
      IN = IN+1
      read (RANUNT(MACHNO),rec=IN) BUFFER
      do 150 I = 1, 4
         TEMP(I:I) = BUFFER(I)
150   continue
      read (TEMP,5000) NN
5000  format (I4)
      L = 4
      M = 0
      do 160 I = 1, NN
         L = L+1
         if (L.gt.VARCEC) then
            IN = IN+1
            read (RANUNT(MACHNO),rec=IN) BUFFER
            L = 1
         endif
         M = M+1
         HELPS(M) = BUFFER(L)
160   continue
      INDX = MATCH(NOHELP,MAXINI,HELEN,HELPS,MINHLP)
      INSAVE = IN
      if (INDX.ne.0) go to 190
170   continue
      INDX = MATCH(NOMOD,LNMODS,MODLEN,MODS,MODMIN)
      INSAVE = IN
      if (INDX.eq.0) go to 240
      if (TD(INDX).eq.0) go to 230
      NEXT = 1
      N1 = 0
      N2 = INDX-1
      do 180 I = 1, N2
         N1 = N1+MODLEN(I)
180   continue
      LENT = MODLEN(INDX)
      N2 = N1+LENT
      N1 = N1+1
      if (MODS(N2).eq.'G') then
         N2 = N2-1
         LENT = LENT-1
      endif
      call DESOUT (INDX,MODS(N1),LENT,TTYOUT(MACHNO))
      if (OPTION.eq.1) go to 250
190   continue
      IN = INSAVE
      if (OPTION.eq.1.or.NEXT.eq.1) IN = RECDAT(7)-1
      I = VARIEC/3
      J = INDX/I
      if (J*I-INDX.ne.0) J = J+1
      IN = IN+J
      read (RANUNT(MACHNO),rec=IN) IBUFF
      IM = INDX-(J-1)*I
      IM = (IM-1)*3+1
      II = IBUFF(IM)
      IOFF = IBUFF(IM+1)-1
      NCHAR = IBUFF(IM+2)
      read (RANUNT(MACHNO),rec=II) CBUFF
      K = 0
      do 210 I = 1, NCHAR
         IOFF = IOFF+1
         if (IOFF.gt.VARCEC) then
            II = II+1
            read (RANUNT(MACHNO),rec=II) CBUFF
            IOFF = 1
         endif
         CIM = CBUFF(IOFF)
         if (CIM.ne.'$') go to 200
         if (K.eq.0) go to 210
         if (K.eq.1.and.INPUT(1:1).eq.' ') go to 210
         write (TTYOUT(MACHNO),5010) INPUT(1:K)
5010     format (1X,A)
         IPRT = 1
         K = 0
         go to 210
200      continue
         K = K+1
         INPUT(K:K) = CIM
210   continue
      if (IPRT.eq.0) write (TTYOUT(MACHNO),5020)
5020  format (/' No information for this variable.')
      go to 250
220   continue
      write (TTYOUT(MACHNO),5030)
5030  format (//' End-of-file encountered.')
      go to 250
230   continue
      write (TTYOUT(MACHNO),5040)
5040  format (//' No information available for this COMMON name.'//)
      go to 250
240   continue
      write (TTYOUT(MACHNO),5050)
5050  format (/' No information available for this request.')
250   continue
      return
      end
