        subroutine CHKSUB(ARGS,INDX,LOWUP,IT)
      include 'MODNAM.INC'
      include 'TRANS.INC'
        real ARGS(10),ARG1,ARG2,ARG3,XX
        integer INDX, LOWUP(6), IT
        integer K,I,ITS,LOW1,LOW2,LOW3,UP1,UP2,UP3
      K = 0
      do 100 I = 1, NOCOM
         K = K+COMVAR(I)
         if (K.ge.INDX) go to 110
100   continue
      IT = -3
      go to 210
110   continue
      ICOM = I
      IVAR = K-COMVAR(I)
      IVAR = INDX-IVAR
      LOW1 = 1
      LOW2 = 1
      LOW3 = 1
      UP1 = 1
      UP2 = 1
      UP3 = 1
      ITS = TS(INDX)
      if (ITS.eq.1) go to 190
      ARG1 = ARGS(1)
      if (ARG1.ne.-1.) go to 120
      LOW1 = 1
      UP1 = TCL1(INDX)
      ARG1 = 1.
      go to 130
120   continue
      LOW1 = int(ARG1)
      UP1 = int(ARG1)
130   continue
      XX = real(TCL1(INDX))
      if (ARG1.lt.1..or.ARG1.gt.XX) go to 200
      if (ITS.le.2) go to 160
      ARG2 = ARGS(2)
      if (ARG2.ne.-1.0) go to 140
      LOW2 = 1
      UP2 = TCL2(INDX)
      ARG2 = 1.
      go to 150
140   continue
      LOW2 = int(ARG2)
      UP2 = int(ARG2)
150   continue
      XX = real(TCL2(INDX))
      if (ARG2.lt.1..or.ARG2.gt.XX) go to 200
160   continue
      ARG3 = ARGS(3)
      if (ITS.le.3) go to 190
      if (ARG3.ne.-1.0) go to 170
      LOW3 = 1
      UP3 = TCL3(INDX)
      ARG3 = 1.
      go to 180
170   continue
      LOW3 = int(ARG3)
      UP3 = int(ARG3)
180   continue
      XX = real(TCL3(INDX))
      if (ARG3.lt.1..or.ARG3.gt.XX) go to 200
190   continue
      LOWUP(1) = LOW1
      LOWUP(2) = LOW2
      LOWUP(3) = LOW3
      LOWUP(4) = UP1
      LOWUP(5) = UP2
      LOWUP(6) = UP3
      IT = 0
      go to 210
200   continue
      IT = 3
210   continue
      return
      end
