R          PMNMAX
      PARAMETER        ( PMNMAX = PMAX*MMAX*NPZMAX )
      INTEGER          LDA, LDB, LDC, LDD, LDGAIN, LDNP, LDNZ
      PARAMETER        ( LDA = NMAX, LDB = NMAX, LDC = PMAX,
     $                   LDD = PMAX, LDGAIN = PMAX, LDNP = PMAX,
     $                   LDNZ = PMAX )
      INTEGER          LIWORK
      PARAMETER        ( LIWORK = NMAX )
      INTEGER          LDWORK
      PARAMETER        ( LDWORK = NMAX*( NMAX + PMAX ) +
     $                            MAX( NMAX + MAX( NMAX,