C 
C 
C                   FIRST PRINTING, FEBRUARY 1974
C 
C THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO 
C CHANGE WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED
C AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
C DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPON-
C SIBILITY FOR ANY ERRORS THAT MAY APPEAR IN THIS
C DOCUMENT.
C 
C THE SOFTWARE DESCRIBED IN THIS DOCUMENT IS FUR-
C NISHED TO THE PURCHASER UNDER A LICENSE FOR USE ON
C A SINGLE COMPUTER SYSTEM AND CAN BE COPIED (WITH
C INCLUSION OF DIGITAL'S COPYRIGHT NOTICE) ONLY FOR 
C USE IN SUCH SYSTEM, EXCEPT AS MAY OTHERWISE BE PRO-
C VIDED IN WRITING BY DIGITAL.
C 
C DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY
C FOR THE USE OR RELIABILITY OF ITS SOFTWARE ON EQUIP-
C MENT THAT IS NOT SUPPLIED BY DIGITAL.
C 
C COPYRIGHT (C) 1974, BY DIGITAL EQUIPMENT CORPORATION
C 
C 
C	ACD SRC  EDIT #2  1/26/74  G. COLE
C	COPYRIGHT DIGITAL EQUIPMENT CORP. 1973
C	RSX-PLUS ACCOUNT SUMMARY PROCESSOR
C	RUN AT THE END OF A BATCH PROCESSING CYCLE
C	MAY ALSO BE RUN AS AN MCR FUNCTION
C	SHOULD BE NAMED ...ACD
C
C	ACD WILL RETRIEVE THE ACCOUNT FILE FROM THE DISK AND
C	SUMMARIZE ITS CONTENTS ONTO THE PRINTER
C
	DOUBLE INTEGER M(12),SIDE,SIDE2,MON,MON2
	INTEGER JPDATE,D,TIME
	DIMENSION ACCNT(512)
	DIMENSION D(6)
	DIMENSION JPDATE(6)
	DIMENSION USR(400)
	EQUIVALENCE (ACCNT(112),USR(1))
	EQUIVALENCE (JSN,ACCNT(1))
	EQUIVALENCE (JSR,ACCNT(3))
	EQUIVALENCE (JST,ACCNT(2))
	EQUIVALENCE (JXXX,ACCNT(4))
	EQUIVALENCE (JPDATE(1),ACCNT(5))
	DATA M(1),M(2),M(3),M(4)/'JAN','FEB','MAR','APR'/
	DATA M(5),M(6),M(7),M(8)/'MAY','JUN','JLY','AUG'/
	DATA M(9),M(10),M(11),M(12)/'SEP','OCT','NOV','DEC'/
C
C
C
	CALL GETAF(ACCNT(1),IEV)
C
C	DEFINE CHARGE FOR SYSTEM SERVICES
C
	CHARGF=10.00
C
C	CHARGE IS IN $ PER HOUR
	IF(IEV.GT.0) GOTO 30
	WRITE(3,33) IEV
33	FORMAT(' *** FATAL ERROR ACCESSING ACCOUNT FILE ',I6,' ***')
	CALL REQMCR
	CALL EXIT
30	CONTINUE
	CALL DATE(D)
	IM=D(1)
	MON=M(IM)
	SIDE='AM'
	IF(D(4).LT.12) GOTO 200
	SIDE='PM'
	IF(D(4).GT.12) D(4)=D(4)-12
200	CONTINUE
	IM=JPDATE(1)
	MON2=M(IM)
	SIDE2='AM'
	IF(JPDATE(4).LT.12) GOTO 210
	SIDE2='PM'
	IF(JPDATE(4).GT.12) JPDATE(4)=JPDATE(4)-12
210	CONTINUE
	WRITE(16,101)
	WRITE(16,102) MON2,(JPDATE(I),I=2,6),SIDE2
	WRITE(16,103) MON,(D(I),I=2,6),SIDE
101	FORMAT(1H1,T30,'RSX-PLUS BATCH PROCESSING SYSTEM'/
	1 T30,'         ACCOUNT SUMMARY'///)
102	FORMAT(T30,'PERIOD BEGINNING',2X,A3,' ',I2,', 19',I2,
	1 '  AT ',I2,':',I2,':',I2,' ',A2/)
103	FORMAT(T30,'PERIOD ENDING   ',2X,A3,' ',I2,', 19',I2,
	1 '  AT ',I2,':',I2,':',I2,' ',A2//)
	CONTINUE
	TIME=0
	DO 300 I=1,99
	IUSR=I
300	TIME=TIME+USR(IUSR)[18:35]
	TIMR=TIME
	CHARGE=CHARGF*TIMR/3600.
	WRITE(16,104) JSN,TIME,CHARGE
104	FORMAT(///T45,'JOBS PROCESSED',T60,I6/
	1 T45,'TOTAL TIME USED',T60,I6,' SEC'/
	2 T45,'TOTAL CHARGE',T59,'$',F6.2//)
C
C	PRINT OUT INDIVIDUAL ACCOUNT SUMMARIES
C
	IF(CHARGE.EQ.0.) GOTO 999
	WRITE(16,105)
	DO 400 I=1,99
	IRNS=USR(I)[0:17]
	RTIM=USR(I)[18:35]
	ITIM=RTIM
	CHARGE=RTIM*CHARGF/3600.0
	RPCTM=(RTIM/TIMR)*100.
	IF(I.EQ.99) GOTO 401
	IF(IRNS.EQ.0) GOTO 400
	WRITE(16,106) I,IRNS,ITIM,CHARGE,RPCTM
400	CONTINUE
401	CONTINUE
	IF(IRNS.EQ.0) GOTO 999
	WRITE(16,107)
	WRITE(16,106) I,IRNS,ITIM,CHARGE,RPCTM
	WRITE(16,108)
	GOTO 999
105	FORMAT(T30,'ACCOUNT',T40,'RUNS',T50,'TIME',T60,'CHARGE',
	1 T70,'% OF USE'//)
106	FORMAT(T30,I4,T40,I4,T48,I6,T58,'$',F7.2,T70,F6.2,'%'/)
107	FORMAT(/,T30,'***** RUNS MADE TO INVALID ACCOUNTS *****'/)
108	FORMAT(/T50,'END OF SUMMARY'/1H1)
999	CALL REQMCR
	CALL EXIT
	END
