	SUBROUTINE USERS(OUT,MANUS,MANJB,MATIME,TTYUC)
	IMPLICIT INTEGER(A-Z)
	DOUBLE INTEGER MATIME
	LOGICAL BATCH
	REAL MEAN
	DIMENSION TTYUC(#22)
	DIMENSION TERMS(#22)
	DATA BATCH/.FALSE./
C
C	CALCULATE NUMBER OF ACTIVE USERS
C
	J = 0
	DO 10 I = 1,#22
	IF(TTYUC(I).EQ.-1) GO TO 10
	J = J + 1
	TERMS(J)=I-1
10	CONTINUE
	CALL SPY (#176,I,EV)
	IF(I.NE.TERMS(J)) GO TO 15
	BATCH = .TRUE.
	J = J-1
	IF(J) GO TO 15
60	WRITE(OUT,50)
50	FORMAT(2X,'BATCH IS ACTIVE')
	RETURN
15	MEAN = MATIME/MANJB
	WRITE(OUT,20) J,MANUS,MANJB,MEAN
20	FORMAT(1X,I2,' ACTIVE USER(S) ',/,1X,' TOTAL NUMBER OF USER(S) = '
     1  ,I4,/,1X,' TOTAL NUMBER OF JOB(S) = ',I4,/,1X,
     2  ' MEAN WAIT TIME IS ',F5.2,' SECONDS/JOB')
	WRITE(OUT,30) (TERMS(I),I=1,J)
30	FORMAT(2X,'ACTIVE TERMINAL NUMBERS ARE:',
     1  14(I3),/,2X,3(I3))
	IF(BATCH) GO TO 60
	RETURN
	END
