CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	ACI.NN -- BATCH ACCOUNTING FILE INITIALIZATION 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		12	USED TO OBTAIN INPUT FROM THE USER.

C

C		13	USED TO PRINT MESSAGES FOR THE USER.

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

	DOUBLE INTEGER TEMP,TEMP2

	DOUBLE INTEGER FILNAM(2),PASSWD

	DATA FILNAM / 'USERS',' RSX' /

	DATA PASSWD / '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

C	PASSWD CONTAINS THE PASSWORD WHICH THE USER MUST

C	PROVIDE TO INITIALIZE OR MODIFY THE ACCOUNTING

C	FILE.

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	PRINT HELLO MESSAGE, REQUEST AND VERIFY PASSWORD:

C

	WRITE (13,100)

100	FORMAT (' ','XVM/RSX MULTIACCESS BATCH ACCOUNTING ',

     1            'FILE INITIALIZATION',/,

     2          ' ','ENTER PASSWORD:')

	READ (12,110) TEMP

110	FORMAT (A3)

	WRITE (12,120)

120	FORMAT ('+XXXXXX',/,'+HHHHHH',/,'+IIIIII',/,'+      ')

	IF (TEMP .NE. PASSWD) CALL EXIT

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	VERIFY BATCH IS NOT RUNNING:

C

	CALL SPY (#147,I)

	IF (I .LE. 0) GO TO 299

	WRITE (13,200)

200	FORMAT (' ','ACI -- CANNOT ALTER ACCOUNTING FILE ',

     1            'WHILE BATCH IS ACTIVE')

	CALL EXIT

299	CONTINUE

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	DETERMINE IF ACCOUNTING FILE CURRENTLY EXISTS

C	AND OPEN ACCOUNTING FILE:

C

	TEMP='     '

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

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

	CALL WAITFR(I)

	IF (I .EQ. -#13) GO TO 600

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

	CALL WAITFR(I)

	IF (I .GT. 0) GO TO 399

	I=-I

	WRITE (13,300) I

300	FORMAT (' ','ACI -- ACCOUNTING FILE ACCESS ERROR.  ',

     1            'DEFINE EV = -',O6)

	CALL EXIT

399	CONTINUE

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	DETERMINE WHETHER TO INITIALIZE OR MODIFY

C	ACCOUNTING FILE:

C

	WRITE (13,400)

400	FORMAT (' ','RESET ALL ACCOUNTS (YES/NO) ?')

	READ (12,410) TEMP

410	FORMAT (A3)

	IF (TEMP .EQ. 'YES') GO TO 700

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	MODIFY AN INDIVIDUAL ACCOUNT:

C

500	WRITE (13,510)

510	FORMAT (' ','ENTER ACCOUNT NUMBER TO BE EDITED, ',

     1            'OR 0 TO EXIT:')

	READ (12,) K

	IF (K .EQ. 0) GO TO 590

	IF (K .LE. 0 .OR. K .GT. 100) GO TO 580

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

	WRITE (13,520) JOBS(K),RUNTIM(K)

520	FORMAT (' ',28X,'JOBS',6X,'RUN TIME',/,

     1          ' ','CURRENT VALUES:  ',2I14,/,

     2          ' ','ENTER NEW VALUES:')

	READ (12,) TEMP,TEMP2

	WRITE (13,530) TEMP,TEMP2

530	FORMAT (' ','NEW VALUES:',6X,2I14)

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

	JOBS(K)=TEMP

	RUNTIM(K)=TEMP2

	WRITE (10'1,ERR=560) JPDATE,ACTNUM,JOBS,RUNTIM

	GO TO 500

C

560	WRITE (13,565)

565	FORMAT (' ','ACI -- ACCOUNTING FILE WRITE ERROR')

	GO TO 599

C

570	WRITE (13,575)

575	FORMAT (' ','ACI -- ACCOUNTING FILE READ ERROR')

	GO TO 599

C

580	WRITE (13,585)

585	FORMAT (' ','ACI -- ILLEGAL ACCOUNT NUMBER')

	GO TO 599

C

590	WRITE (13,595)

595	FORMAT (' ','ACCOUNT FILE EDITTED.')

599	CALL EXIT

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	CREATE NEW ACCOUNTING FILE:

C

600	WRITE (13,610)

610	FORMAT (' ','CREATE NEW ACCOUNTING FILE (YES/NO) ?')

	READ (12,620) TEMP

620	FORMAT (A3)

	IF (TEMP .NE. 'YES') CALL EXIT

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

	CALL WAITFR(I)

	IF (I .LE. 0) GO TO 690

	WRITE (13,630)

630	FORMAT (' ','ACCOUNTING FILE CREATED')

	GO TO 700

C

690	I=-I

	WRITE (13,695) I

695	FORMAT (' ','ACI -- ACCOUNTING FILE CREATION ERROR.  ',

     1            'DEFINE EV = -',O6)

	CALL EXIT

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	INITIALIZE ACCOUNTING FILE -- I.E., RESET ALL

C	ACCOUNTS TO ZERO.

C

700	DO 710 I=1,100

	JOBS(I)=0

	RUNTIM(I)=0

710	CONTINUE

	CALL DATE(JPDATE)

	ACTNUM=100

	WRITE (10'1,ERR=790) JPDATE,ACTNUM,JOBS,RUNTIM

	WRITE (13,720)

720	FORMAT (' ','ACCOUNTS INITIALIZED')

	GO TO 799

C

790	WRITE (13,795)

795	FORMAT (' ','ACI -- ACCOUNTING FILE WRITE ERROR')

799	CALL EXIT

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

	END
