C     .TITLE JOBSTR SRC
C
C   8 SEP 77 (PDH) LENGTHEN HEADER PAGE SO WE CAN TEAR IT MORE EASILY
C   9 MAR 77 (PDH) ADD DATE AND TIME TO '***END  # NNN'
C  13 OCT 76 (PDH) CHANGE FORMAT OF JOB HEADER PAGE AGAIN
C   8 OCT 76 - PAUL HENDERSON - SHORTEN THE OUTPUT CONSIDERABLY
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	JOBSTR SRC  EDIT #3  1/30/74  G. COLE
C	COPYRIGHT DIGITAL EQUIPMENT CORP. 1973
	DOUBLE INTEGER M,FNAM,MON,BUF
	INTEGER D(6),RST,TST
	DIMENSION BUF(30),ACCNT(512),USR(400),FNAM(2),M(12)
	EQUIVALENCE (ACCNT(112),USR(1)),(JSN,ACCNT(1))
	EQUIVALENCE (JSR,ACCNT(3)),(JST,ACCNT(2))
	EQUIVALENCE (JXXX,ACCNT(4))
	DATA M(1),M(2),M(3),M(4)/'JAN','FEB','MAR','APR'/
	DATA M(5),M(6)/'MAY','JUN'/
	DATA M(7),M(8),M(9),M(10)/'JUL','AUG','SEP','OCT'/
	DATA M(11),M(12)/'NOV','DEC'/
	DATA CHARGF/10.0/
C
C
C
C
	CALL GETAF(ACCNT(1),IEV)
	IF(IEV.GT.0) GO TO 30
	WRITE(64,33) IEV
33	FORMAT(' *** FATAL ERROR ACCESSING ACCOUNT FILE ',I6,' ***')
	CALL XFC(BUF(1),60,IEV)
	CALL GETDV
	CALL EXIT
30	CALL XFC(BUF(1),60,IEV)
	IF(IEV.LT.0) CALL EXIT
111	CALL DATE(D)
	IM=D(1)
	IDAY=D(2)
	IYER=D(3)
	IHOR=D(4)
	IMIN=D(5)
	ISEC=D(6)
	IST=IHOR*3600+IMIN*60+ISEC
	MON=M(IM)
	IF(JXXX.EQ.101010) GO TO 300
	DO 400 I=1,512
400	ACCNT(I)=0
	JXXX=101010
300	CONTINUE
	IF(JSR.NE.0) GO TO 900
	JSN=JSN+1
	JST=IST
	IUSR=(BUF(3)[0:6]-48)*10
	IUSR=IUSR+BUF(3)[7:13]-48
	IF(IUSR.LT.1) IUSR=99
	IF(IUSR.GT.98) IUSR=99
	IF(IUSR.EQ.99) WRITE(64,130)
130	FORMAT(' *** INVALID ACCOUNT ***')
	USR(IUSR)[0:17]=USR(IUSR)[0:17]+1
	IRSN=USR(IUSR)[0:17]
	ILIM=(BUF(3)[21:27]-48)*10
	ILIM=ILIM+BUF(3)[28:34]-48
	ILIM=ILIM*10+BUF(4)[0:6]-48
	IF(ILIM.LT.1) ILIM=5
	IF(ILIM.GT.999) ILIM=5
C
C  DO NOT ALLOW ILLEGAL ACCOUNTS TO HAVE ANY COMPUTING TIME
C
      IF (IUSR .EQ. 99) ILIM = 0
	CALL RUNTLE(ILIM)
666	CONTINUE
	JSR=IUSR
	CALL PUTAF
	WRITE(16,101) IDAY,MON,IYER,IHOR,IMIN,ISEC,JSN,
	1 (BUF(I),I=2,13),IUSR,IRSN
	CALL GETDV
	CALL EXIT
900	RST=IST-JST
	CALL CANTLE
	IF(RST.GT.0) GO TO 901
	RST=((24*3600)-JST)+IST
901	USR(JSR)[18:35]=USR(JSR)[18:35]+RST
	TST=USR(JSR)[18:35]
	COST=(FLOAT(RST)/3600.)*CHARGF
	WRITE(64,150)JSN,IDAY,MON,IYER,IHOR,IMIN,ISEC
150	FORMAT(' ***END  #',I4,I3,1XA3,I3,I4,':',I2,':',I2)
	WRITE(16,102) JSN,IDAY,MON,IYER,IHOR,IMIN,ISEC,
	1 JSR,RST,COST,TST
	JSR=0
	GO TO 111
101   FORMAT ('1',3(T10,'PDP-15 XVM/RSX V1A BATCH',//),T10,
     * 'PDP-15 XVM/RSX V1A BATCH',T62,'UNIVERSITY OF WATERLOO',//,T10,
     * 'PDP-15 XVM/RSX V1A BATCH',T60,'ENGINEERING COMPUTER CENTRE',//,
     * T10,'PDP-15 XVM/RSX V1A BATCH',/,T60,I2,1XA3,I3,I5,2(':',I2),
     * '  JOB NUMBER',I6,3(/,T10,'PDP-15 XVM/RSX V1A BATCH',/),T60,
     *             12A5, 2(/,T10,'PDP-15 XVM/RSX V1A BATCH',/),T67,
     * 'ACCOUNT NUMBER',I4,/,T10,'PDP-15 XVM/RSX V1A BATCH',/,T69,
     * 'RUN NUMBER', I6, 6(/,T10,'PDP-15 XVM/RSX V1A BATCH',/),///)
C
C
102   FORMAT (//,'****************************************',
     * '****************************************  END OF JOB NUMBER',
     * I5,//,I3,1XA3,I3,I4,2(':',I2),'  ACCOUNT NUMBER',
     * I4,';  RUNNING TIME',I6,' SEC;  COST OF RUN $',
     * F5.2,';  TIME USED TO DATE',I6,' SEC.')
	END
