C	PROGRAM TO REPORT CONTENTS OF TTYLOG DATA FILE
C
C	VERSION TO REPORT ON ONE TERM ONLY, ONE DAY ONLY PER RUN
C
	INTEGER*2 REPTIM(8),RUNTIM(40),SWATIM(40),WAITIM(40)
	CHARACTER*46 BARGRA,BAR
C	CONTENTS OF TTYLOG DAT FILE
C       FIRST RECORD = 8-WORD GTIM$ RETURN, (YR,MO,DA,HR,MIN,SEC,TIC,TPS)
C       FOLLOWED BY 40. WORD RUN-TIME COUNTER,
C       SECOND RECORD = 40. WORD SWAP TIME COUNTER, 40.WORD WAIT TIME COUNTER
C
	BAR(1:46)='!....!....!....!....!....!....!....!....!....!'
	PRERUN=0.
	PRESWA=0.
	PREWAI=0.
	OPEN (UNIT=3,NAME='LB:[1,100]TTYLOG.DAT',ERR=1000,
	1 STATUS='OLD',ACCESS='SEQUENTIAL',FORM='UNFORMATTED',
	2 RECORDTYPE='VARIABLE')
C
C	INPUT REPORT TIME LIMITS
C
        WRITE (5,100)
  100	FORMAT ('$REPORT DATE (MO,DA,YR) ')
	READ (5,110) IMO,IDA,IYR
  110	FORMAT(3I8)
	WRITE(5,120)
  120	FORMAT ('$TERMINAL NUMBER (OCT) ')
	READ (5,125) ITI
  125	FORMAT(O6)
C
C	START READING FILE
C
  130	READ (3,END=1000) (REPTIM(I),I=1,8),(RUNTIM(I),I=1,40)
	READ (3) (SWATIM(I),I=1,40),(WAITIM(I),I=1,40)
	IF (REPTIM(1).LT.IYR) GOTO 130
	IF (REPTIM(1).GT.IYR) GOTO 1000
	IF (REPTIM(2).LT.IMO) GOTO 130
	IF (REPTIM(2).GT.IMO) GOTO 1000
	IF (REPTIM(3).LT.IDA) GOTO 130
	IF (REPTIM(3).GT.IDA) GOTO 1000
C
C	FOUND ONE WANTED, REPORT IT
C
	WRITE(6,200) ITI, REPTIM(2),REPTIM(3),REPTIM(1)
  200	FORMAT(/,' REPORT FOR TT',O2,' FOR ',I2,'/',I2,'/',I2)
	WRITE(6,210)
  210	FORMAT(' TIME   RUN     SWAP    WAIT   0   20   40',
	1 '   60   80  100  120  140  160  180')
	WRITE(6,220)
  220	FORMAT(' ----  ------  ------  ------  ')
  300	BARGRA(1:46)=BAR(1:46)
	FRUN=FLOAT(RUNTIM(ITI))/10.-PRERUN
	PRERUN=FLOAT(RUNTIM(ITI))/10.
	IRUN=IMIN0(45,IFIX(FRUN)/4)+1
	BARGRA(IRUN:IRUN)='R'
	FSWA=FLOAT(SWATIM(ITI))/10.-PRESWA
	PRESWA=FLOAT(SWATIM(ITI))/10.
	ISWA=IMIN0(45,IFIX(FSWA)/4)+1
	BARGRA(ISWA:ISWA)='S'
	FWAI=FLOAT(WAITIM(ITI))/10.-PREWAI
	PREWAI=FLOAT(WAITIM(ITI))/10.
	IWAI=IMIN0(45,IFIX(FWAI)/4)+1
	BARGRA(IWAI:IWAI)='W'
	WRITE(6,250) REPTIM(4),FRUN,FSWA,FWAI,BARGRA(1:46)
  250	FORMAT(I4,'   ',3(F6.1,'  '),A46)
	IF (REPTIM(4).NE.18) WRITE(6,251)
  251	FORMAT(' ')
C	READ FILE AGAIN FOR NEXT HOUR
	READ (3,END=1000) (REPTIM(I),I=1,8),(RUNTIM(I),I=1,40)
	READ (3) (SWATIM(I),I=1,40),(WAITIM(I),I=1,40)
	IF (REPTIM(3).NE.IDA) GOTO 1000
	GOTO 300
 1000	CLOSE (3)
	CALL EXIT
	END
