      SUBROUTINE MKCOM(PP, K)
      INTEGER PLAT, PDSA, FINDCM, DSA, SYMLEN, PP, PCOM, COM
      LOGICAL SYSERR, ERR, ABORT
      COMMON /GRAPH/ LLAT, PLAT, LAT(6000)
      COMMON /COMS/ LCOM, PCOM, COM(300)
      COMMON /CTABL/ LDSA, PDSA, DSA(5000)
      COMMON /DETECT/ ERR, SYSERR, ABORT
      COMMON /PARAMS/ INUT, I1, NOCHAR, SYMLEN, I2, I3, I4
C
C     WANT TO MARK COMMONLIST ENTRY SET FOR SUBPGM PP; MAY HAVE TO
C     CREATE ENTRY
C
      N = FINDCM(DSA(K+4))
      L = SYMLEN + 2 + PP
      KK = -K
      IF (N.NE.0) KK = N
C
C     LOOK FOR DSA ENTRY ON LIST
C
      I = MATCH(LAT(L),2,KK)
      IF (I) 30, 30, 10
   10 LAT(I+1) = 1
   20 RETURN
C
C     CREATE NEW ENTRY
C
   30 IF (PLAT+3.GT.LLAT) GO TO 40
      LAT(PLAT+1) = 1
      LAT(PLAT+2) = LAT(L)
      LAT(L) = PLAT
      LAT(PLAT) = KK
      PLAT = PLAT + 3
      GO TO 20
   40 SYSERR = .TRUE.
      CALL ERROR1(32H IN MKCOM, TABLE OVERFLOW OF LAT, 32)
      GO TO 20
      END
