      SUBROUTINE GEND(NCARAY,NBARAY,YS,ZS,SG,CG,DT,WORK,MATOUT)
C  GENERATE THE INFLUENCE COEFFICIENT MATRIX ADPP
      COMPLEX DT
      DIMENSION NCARAY(1),NBARAY(1),YS(1),ZS(1),SG(1),CG(1),
     1          DT(1),WORK(1)
      COMMON /AMGMN / MCB(7),NROW,ND,NE,REFC,FMACH,RFK
      COMMON /DLCOM / NP,NSTRIP,NTP,F,NJJ,NEXT,LENGTH,
     1                INC,INB,IYS,IZS,IEE,ISG,ICG,
     2                IXIC,IDELX,IXLAM,IDT,
     3  ICORE
      I1 = 1
      I2 = NTP
      J1 = 1
      J2 = NTP
C
C     POSITION IN DT TO START OF THIS PART OF MATRIX
C
      IDTPT = I1 + NROW
      DO 10 I = I1,NJJ
   10 DT(I) = (0.0,0.0)
C     DPP LOOP
      K = 1
C     K IS THE PANEL NUMBER
      KS = 1
C     KS IS THE STRIP NUMBER
      NBXR = NCARAY(K)
      DO 60 I = I1,I2
      SGR = SG(KS)
      CGR = CG(KS)
      CALL DPPS(KS,I,J1,J2,SGR,CGR,YS,ZS,NBARAY,NCARAY,DT(IDTPT),WORK)
      CALL PACK(DT,MATOUT,MCB)
      IF(I.EQ.I2) GO TO 60
      IF(I.EQ.NBARAY(K)) K=K+1
      IF(I.EQ.NBXR) GO TO 50
      GO TO 60
   50 CONTINUE
      KS = KS +1
      NBXR = NBXR + NCARAY(K)
   60 CONTINUE
      RETURN
      END
