CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	ACD.NN -- BATCH ACCOUNTING FILE DISPLAY PROGRAM.

C

C    COPYRIGHT (C) 1976

C    DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

C

C    THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY

C    ON A SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH

C    THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS

C    SOFTWARE, OR ANY OTHER COPIES THEREOF, MAY NOT BE PRO-

C    VIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON

C    EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO

C    THESE LICENSE TERMS.  TITLE TO AND OWNERSHIP OF THE

C    SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.

C

C    THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE

C    WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COM-

C    MITMENT BY DIGITIAL EQUIPMENT CORPORATION.

C

C    DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY

C    OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C   5	2-AUG-76 (EAG)		INITIAL VERSION FOR XVM/RSX

C				MULTIACCESS.

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	THIS PROGRAM USES THE FOLLOWING LUNS:

C

C		13	USED TO PRINT ERROR MESSAGES.

C

C		16	USED TO PRINT ACCOUNTING FILE SUMMARY.

C

C		10	USED TO ACCESS BATCH ACCOUNTING FILE.

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	DECLARE VARIABLES STORED IN BATCH ACCOUNTING FILE:

C

	INTEGER JPDATE(6),ACTNUM

	DOUBLE INTEGER JOBS(100),RUNTIM(100)

C

C	THE VALUES STORED IN THE ACCOUNTING FILE ARE

C	AS FOLLOWS:

C

C		JPDATE	TIME & DATE WHEN ACCOUNTING FILE

C			WAS LAST INITIALIZED, IN FORMAT

C			RETURNED BY LIBRARY SUBROUTINE

C			"DATE".

C

C		ACTNUM	THE ACCOUNT NUMBER OF THE CURRENTLY

C			RUNNING JOB.

C

C		JOBS	THE NUMBER OF JOBS WHICH HAVE BEEN

C			RUN UNDER EACH ACCOUNT NUMBER.

C

C		RUNTIM	THE TOTAL RUN TIME FOR ALL JOBS RUN

C			UNDER EACH ACCOUNT NUMBER.

C

C	JOBS AND RUNTIM ARE BOTH ARRAYS WHICH USE THE ACCOUNT

C	NUMBER FOR A SUBSCRIPT.  ACCOUNT NUMBER 100 IS USED

C	WHENEVER THE $JOB CARD HAS AN ILLEGAL ACCOUNT NUMBER

C	OR THE ACCOUNT NUMBER IS OTHERWISE UNAVAILABLE.

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	DECLARE OTHER VARIABLES:

C

	INTEGER I,J,K,L,M,N

	INTEGER TODAY(6),ACCNTS(99)

	DOUBLE INTEGER TEMP,TEMP2

	DOUBLE INTEGER MONTHS(12),FILNAM(2)

	DATA MONTHS / 'JAN', 'FEB', 'MAR', 'APR',

     1                'MAY', 'JUN', 'JUL', 'AUG',

     2                'SEP', 'OCT', 'NOV', 'DEC' /

	DATA FILNAM / 'USERS',' RSX' /

C

C	FILNAM CONTAINS THE NAME OF THE BATCH ACCOUNTING

C	FILE.  NOTE THAT THE FILE NAME (EXCLUDING THE FILE

C	EXTENSION) MUST BE FIVE OR FEWER CHARACTERS.  THIS

C	MEANS THAT THE FIRST CHARACTER IN THE SECOND ENTRY

C	OF FILNAM MUST BE A SPACE.

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	DETERMINE IF BATCH ACCOUNTING FILE EXISTS, ACCESS

C	THE ACCOUNTING FILE, THEN READ IT IN.

C

	TEMP='     '

	TEMP[0:20]=FILNAM(2)[7:27]

	CALL SEEK(10,FILNAM(1),TEMP,I)

	CALL WAITFR(I)

	IF (I .NE. -#13) GO TO 120

	WRITE (13,110)

110	FORMAT (' ','ACD -- NO BATCH ACCOUNTING FILE.')

	CALL EXIT

C

120	CALL DEFINE (10,407,1,FILNAM,J,0,0,0,I)

	CALL WAITFR(I)

	IF (I .GT. 0) GO TO 140

	I=-I

	WRITE (13,130) I

130	FORMAT (' ','ACD -- ACCOUNTING FILE ACCESS ERROR.  ',

     1            'DEFINE EV = -',O6)

	CALL EXIT

C

140	READ (10'1,ERR=150) JPDATE,ACTNUM,JOBS,RUNTIM

	GO TO 199

C

150	WRITE (13,160)

160	FORMAT (' ',20X,'ACD -- ACCOUNTING FILE READ ERROR.')

	CALL EXIT

C

199	CONTINUE

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	PRINT PAGE HEADER:

C

	CALL DATE (TODAY)

	I=JPDATE(5)/10

	J=JPDATE(5)-I*10

	K=JPDATE(6)/10

	L=JPDATE(6)-K*10

	WRITE (16,200) JPDATE(2),MONTHS(JPDATE(1)),JPDATE(3),

     1                 JPDATE(4),I,J,K,L

200	FORMAT ('1','XVM/RSX MULTIACCESS BATCH ACCOUNTING ',

     1            'FILE SUMMARY',/,

     2          ' ',/,

     3          ' ','PERIOD BEGINNING ',I2,'-',A3,'-',I2,

     4            ' AT ',I2,':',2I1,':',2I1)

	I=TODAY(5)/10

	J=TODAY(5)-I*10

	K=TODAY(6)/10

	L=TODAY(6)-K*10

	WRITE (16,210) TODAY(2),MONTHS(TODAY(1)),TODAY(3),

     1                 TODAY(4),I,J,K,L

210	FORMAT (' ','      AND ENDING ',I2,'-',A3,'-',I2,

     1            ' AT ',I2,':',2I1,':',2I1,/,

     2          ' ',/,

     3          ' ')

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	CALCULATE TOTALS AND DETERMINE WHICH ACCOUNTS HAVE

C	BEEN USED:

C

	I=0

	TEMP=0

	TEMP2=0

	DO 300 J=1,99

	IF (JOBS(J) .EQ. 0 .AND. RUNTIM(J) .EQ. 0) GO TO 300

	I=I+1

	ACCNTS(I)=J

	TEMP=TEMP+JOBS(J)

	TEMP2=TEMP2+RUNTIM(J)

300	CONTINUE

	TEMP=TEMP+JOBS(100)

	TEMP2=TEMP2+RUNTIM(100)

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	PRINT THE COLUMN HEADINGS:

C

	IF (I .LE. 50) WRITE (16,400)

	IF (I .GT. 50) WRITE (16,410)

400	FORMAT (' ',5X,'ACCOUNT',10X,'JOBS',6X,'RUN TIME',/,

     1          ' ',5X,'-------',10X,'----',6X,'--------')

410	FORMAT (' ',2(5X,'ACCOUNT',10X,'JOBS',6X,'RUN TIME'),/,

     1          ' ',2(5X,'-------',10X,'----',6X,'--------'))

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	PRINT THE ACCOUNTS:

C

	DO 590 J=1,50

	IF (J .GT. I) GO TO 599

	K=J+50

	IF (K .GT. I) WRITE (16,500) ACCNTS(J),JOBS(ACCNTS(J)),

     1                               RUNTIM(ACCNTS(J))

	IF (K .LE. I) WRITE (16,510) ACCNTS(J),JOBS(ACCNTS(J)),

     1                               RUNTIM(ACCNTS(J)),

     2                               ACCNTS(K),JOBS(ACCNTS(K)),

     3                               RUNTIM(ACCNTS(K))

500	FORMAT (' ',7X,I2,2X,2I14,1X)

510	FORMAT (' ',2(7X,I2,2X,2I14,1X))

590	CONTINUE

599	CONTINUE

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	PRINT THE ILLEGAL ACCOUNT:

C

	WRITE (16,600) JOBS(100),RUNTIM(100)

600	FORMAT (' ',/,

     1          ' ',5X,'ILLEGAL',I13,I14)

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	PRINT THE ACCOUNT TOTALS:

C

	IF (I .LE. 50) WRITE (16,700)

	IF (I .GT. 50) WRITE (16,710)

700	FORMAT (' ',40('-'))

710	FORMAT (' ',80('-'))

	WRITE (16,720) TEMP,TEMP2

720	FORMAT (' ','TOTAL',6X,2I14)

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

	END
