CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	END.NN -- BATCH JOB TERMINATION PROCESSOR.

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  01	2-AUG-76 (EAG)		INITIAL VERSION FOR XVM/RSX
C				MULTIACCESS.
C
C  02	2-SEP-76 (EAG)		FIX BUG WHICH CAUSED READ
C				ERROR EV VALUE TO BE PRINTED
C				AS ZERO.  SOME PORTIONS USED
C				INEV AS THE VARIABLE NAME,
C				OTHER PORTIONS USED ERREV.
C				CHANGE ALL SUCH TO INEV.

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C
C	THIS PROGRAM USES THE FOLLOWING LUNS, WHICH HAVE BEEN
C	PREVIOUSLY ASSIGNED APPROPRIATELY BY THE BATCH HANDLER:

C

C		4	USED TO PRINT MESSAGES TO THE OPERATOR

C			TERMINAL.

C

C		12	USED TO READ INFORMATION LINES FROM THE

C			BATCH HANDLER.  THESE LINES, DESCRIBED

C			BELOW, CONTAIN VARIOUS ACCOUNTING AND

C			JOB IDENTIFICATION INFORMATION.

C

C		13	USED TO ACCESS BATCH ACCOUNTING FILE.

C

C		16	USED TO PRINT MESSAGES TO THE LISTING

C			DEVICE.

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	DECLARE VARIABLES INTO WHICH WE WILL READ THE JOB

C	TERMINATION INFORMATION:

C

	INTEGER ENDTIM(4),RUNEND,JOBFND

	LOGICAL STPFLG,JOBERR(17)

	INTEGER SKEV,NTREV,INEV,WRTEV

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	DECLARE VARIABLES INTO WHICH WE WILL READ THE BEGINNING

C	OF JOB INFORMATION:

C

	INTEGER BEGTIM(4),JOBNUM,RUNBEG

	LOGICAL JOBCRD

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	DECLARE VARIABLES INTO WHICH WE WILL READ THE

C	INFORMATION FROM THE JOB QUEUE NODE:

C

	INTEGER FILTIM(4)

	DOUBLE INTEGER JBNAM1,JBNAM2

	INTEGER JBID

	LOGICAL DLTFLG,OPRFLG,FRCFLG,SEQFLG

	LOGICAL HLDFLG,CCLFLG,UFDFLG

	INTEGER TIMEST,CLASS,MEMSIZ,SUBTIM(4)

	INTEGER INDEV,LSTDEV,LGNDEV

	INTEGER INUNT,LSTUNT,LGNUNT

	DOUBLE INTEGER INUFD,LSTUFD,LGNUFD

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	DECLARE VARIABLE INTO WHICH WE WILL READ THE $JOB

C	CARD OR THE $END CARD, IF EITHER HAS TERMINATED

C	THE JOB.

C

	INTEGER JOBLIN(132)

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	DECLARE VARIABLES STORED IN BATCH ACCOUNTING FILE:

C

	INTEGER JPDATE(6),ACTNUM

	DOUBLE INTEGER JOBS(100),RUNTIM(100)

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	DECLARE OTHER VARIABLES:

C

	LOGICAL UNUSED,LAST

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

	INTEGER HOUR,MIN1,MIN10,SEC1,SEC10

	DOUBLE INTEGER MONTHS(12),FILNAM(2),TEMP

	DOUBLE INTEGER ERRORS(151)

	DOUBLE INTEGER INMSG(2),SKMSG(2),LSTMSG(2)

	DOUBLE INTEGER NTRMSG(2),LGNMSG(3),ERRMSG(2)

	DOUBLE INTEGER WRTMSG(2)

	EQUIVALENCE (INMSG,ERRORS(11))

	EQUIVALENCE (SKMSG,ERRORS(19))

	EQUIVALENCE (LSTMSG,ERRORS(32))

	EQUIVALENCE (NTRMSG,ERRORS(41))

	EQUIVALENCE (LGNMSG,ERRORS(54))

	EQUIVALENCE (ERRMSG,ERRORS(90))

	EQUIVALENCE (WRTMSG,ERRORS(99))

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

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

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

	DATA FILNAM / 'USERS',' RSX' /

	DATA ERRORS /

     1       11, 'INPUT', ' DEVI', 'CE AS', 'SIGNM', 'ENT F',

     2           'AILUR', 'E.  I', 'NPUT ', 'DEVIC', 'E = D',

     3           'DUU  ',

     4        7, 'JOB F', 'ILE S', 'EEK E', 'RROR.', '  EV ',

     5           '= -NN', 'NNNN ',

     6       12, 'LISTI', 'NG DE', 'VICE ', 'ASSIG', 'NMENT',

     7           ' FAIL', 'URE. ', ' LIST', 'ING D', 'EVICE',

     8           ' = DD', 'UU   ',

     9        8, 'LISTI', 'NG FI', 'LE EN', 'TER E', 'RROR.',

     A           '  EV ', '= -NN', 'NNNN ',

     B       13, 'ILLEG', 'AL LO', 'GIN D', 'ISK, ', 'UNIT,',

     C           ' OR U', 'FD.  ', 'LOGIN', ' SPEC', 'IFIER',

     D           ' = DD', 'UU <U', 'FD>  ',

     E       10, 'END O', 'F JOB', ' REAC', 'HED I', 'N JOB',

     F           ' FILE', ' ($JO', 'B CAR', 'D REA', 'D).  ',

     G        7, 'END O', 'F JOB', ' FILE', ' (END', '-OF-F',

     H           'ILE R', 'EAD).',

     I        7, 'END O', 'F JOB', ' FILE', ' ($EN', 'D CAR',

     J           'D REA', 'D).  ',

     K        7, 'JOB F', 'ILE R', 'EAD E', 'RROR.', '  EV ',

     L           '= -NN', 'NNNN ',

     M        8, 'LISTI', 'NG FI', 'LE WR', 'ITE E', 'RROR.',

     N           '  EV ', '= -NN', 'NNNN ',

     O        8, '*****', 'UNKNO', 'WN ER', 'ROR F', 'LAG (',

     P           'BIT 1', '1).  ', '*****',

     Q        7, 'TIME ', 'LIMIT', ' EXCE', 'EDED ', '-- JO',

     R           'B ABO', 'RTED.',

     S        7, 'TIME ', 'LIMIT', ' EXCE', 'EDED ', '-- JO',

     T           'B STO', 'PPED.',

     U        7, 'TIME ', 'LIMIT', ' EXCE', 'EDED ', '-- JO',

     V           'B KIL', 'LED. ',

     W        5, 'JOB A', 'BORTE', 'D BY ', 'OPERA', 'TOR. ',

     X        5, 'JOB S', 'TOPPE', 'D BY ', 'OPERA', 'TOR. ',

     Y        5, 'JOB K', 'ILLED', ' BY O', 'PERAT', 'OR.  '  /

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	ERRORS CONTAINS THE TEXT OF THE MESSAGES ASSOCIATED

C	WITH THE JOBERR ARRAY READ IN WITH THE JOB TERMIN-

C	ATION MESSAGE.  THE TEXT MUST NOT BE CHANGED WITHOUT

C	CHANGING THE CODE WHICH ACCESSES IT.

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	READ IN LINE CONTAINING JOB TERMINATION INFORMATION:

C

	READ (12,100) ENDTIM,RUNEND,JOBFND,STPFLG,JOBERR,

     1                SKEV,NTREV,INEV,WRTEV

100	FORMAT ((I3,I2,I2,I5),I6,I1,18L1,4I7)

C

C	THE VALUES READ IN ARE AS FOLLOWS:

C

C		ENDTIM	TIME & DATE AT END OF JOB (I.E., WHEN

C			END... WAS CALLED).

C

C		RUNEND	ACCUMULATED JOB FILE RUN TIME (SECONDS)

C			AT END OF THIS JOB.

C

C		JOBFND	JOB STATUS AT TERMINATION:

C			0 ==> JOB NEVER EXECUTED (I.E. END...

C				WAS RUN IMMEDIATELY AFTER

C				JOB...).

C			1 ==> JOB WAS EXECUTING NORMALLY AT

C				JOB TERMINATION.

C			2 ==> JOB HAS BEEN KILLED AND WAS

C				SCANNING FOR A $ERR CARD

C				AT JOB TERMINATION.

C

C		STPFLG	JOB WAS ABORTED AND/OR STOPPED FOR

C			ANY OF THE REASONS LISTED IN JOBERR.

C

C		JOBERR(1)	ASSIGNMENT FAILURE WHEN

C				ATTEMPTING TO ASSIGN JOB

C				INPUT FILE DEVICE.

C

C		JOBERR(2)	SEEK ERROR WITH JOB

C				INPUT FILE.

C

C		JOBERR(3)	ASSIGNMENT FAILURE WHEN

C				ATTEMPTING TO ASSIGN

C				LISTING DEVICE.

C

C		JOBERR(4)	ENTER ERROR WITH LISTING

C				FILE.

C

C		JOBERR(5)	ILLEGAL LOGIN DEVICE/UFD

C				(AN EXPLICIT DEVICE/UFD

C				WAS SPECIFIED.)

C

C		JOBERR(6)	JOB ATTEMPTED TO READ A

C				$JOB CARD.

C

C		JOBERR(7)	END-OF-FILE REACHED ON JOB

C				INPUT FILE OR JOB ATTEMPTED

C				TO READ A $QUIT CARD.

C

C		JOBERR(8)	JOB ATTEMPTED TO READ A

C				$END CARD.

C

C		JOBERR(9)	READ ERROR WITH JOB

C				INPUT FILE.

C

C		JOBERR(10)	WRITE ERROR WITH LISTING FILE.

C

C		JOBERR(11)	RESERVED.

C

C		JOBERR(12)	JOB ABORTED DUE TO TIME

C				LIMIT OVERRUN.

C

C		JOBERR(13)	JOB STOPPED DUE TO TIME

C				LIMIT OVERRUN.

C

C		JOBERR(14)	JOB KILLED DUE TO TIME

C				LIMIT OVERRUN.

C

C		JOBERR(15)	JOB ABORTED BY OPERATOR.

C

C		JOBERR(16)	JOB STOPPED BY OPERATOR.

C

C		JOBERR(17)	JOB KILLED BY OPERATOR.

C

C		SKEV	EVENT VARIABLE VALUE FROM JOB INPUT

C			FILE SEEK.

C

C		NTREV	EVENT VARIABLE VALUE FROM LISTING

C			FILE ENTER.

C
C		INEV	EVENT VARIABLE VALUE FROM LAST JOB

C			INPUT FILE READ.

C

C		WRTEV	EVENT VARIABLE FROM LAST LISTING FILE
C			WRITE WHICH RESULTED IN AN ERROR.

C

C	RUNEND IS THE TOTAL RUN TIME FOR ALL JOBS IN THE

C	CURRENT JOB FILE UP TO AND INCLUDING THE CURRENT JOB

C	(THE JOB NOW ENDING).  TO DETERMINE THE RUN TIME FOR

C	JUST THIS JOB, SUBTRACT RUNBEG (READ IN AS PART OF

C	THE BEGINNING OF JOB MESSAGE) FROM RUNEND.

C

C	THERE IS NO REASON TO EVER REFERENCE STPFLG.  STPFLG

C	SHOULD NOT BE USED UNLESS YOU ARE FAMILIAR WITH THE

C	INTERNAL WORKINGS OF BATCH.

C

C	JOBFND = 0 IMPLIES THAT THE JOB WAS TERMINATED DURING

C	JOB INITIALIZATION.  JOBFND = 1 OR 2 IMPLIES THAT

C	JOB INITIALIZATION COMPLETED SUCCESSFULLY.  JOB

C	INITIALIZATION CONSISTS OF ASSIGNING THE INPUT AND

C	LISTING DEVICES, OPENING THE INPUT AND LISTING

C	FILES, AND LOGGING IN TO TDV.

C

C	FLAGS JOBERR(1) THROUGH JOBERR(5) CAN ONLY OCCUR

C	DURING JOB INITIALIZATION -- I.E., THEY IMPLY THAT JOB

C	INITIALIZATION DID NOT COMPLETE SUCCESSFULLY AND

C	THAT JOBFND = 0.

C

C	FLAGS JOBERR(6) AND JOBERR(12) THROUGH JOBERR(14)

C	CAN ONLY OCCUR WHILE A JOB IS  EXECUTING -- I.E., THEY

C	IMPLY THAT JOB INITIALIZATION COMPLETED SUCCESSFULLY

C	AND THAT JOBFND = 1 OR 2.

C

C	FLAGS JOBERR(7) THROUGH JOBERR(9) AND JOBERR(15)

C	THROUGH JOBERR(17) CAN OCCUR AT ANY TIME.

C

C	THE FOLLOWING SETS OF ERROR FLAGS ARE MUTUALLY

C	EXCLUSIVE:

C

C		JOBERR(1) AND JOBERR(2)

C

C		JOBERR(3) AND JOBERR(4)

C

C		JOBERR(6) THROUGH JOBERR(9)

C

C		JOBERR(12) THROUGH JOBERR(14)

C

C	IF JOBFND IS 1, JOBERR(6) THROUGH JOBERR(8) EACH

C	IMPLY THAT THE JOB EXECUTED TO COMPLETION.  NOTE,

C	HOWEVER, THAT IF EITHER JOBERR(14) OR JOBERR(17) IS

C	SET, THE JOB WAS FIRST KILLED AND THEN RESUMED FROM

C	A $ERROR CARD.

C
C	SKEV, NTREV, INEV, AND WRTEV SHOULD ONLY BE USED
C	IF JOBERR(2), JOBERR(4), JOBERR(9), OR JOBERR(10)

C	(RESPECTIVELY) IS TRUE.

C

C	IF ANY ERROR FLAG OTHER THAN JOBERR(6) IS SET, THE

C	CURRENT JOB (THE JOB NOW ENDING) WILL BE THE LAST

C	JOB RUN FROM THE CURRENT JOB FILE.  ADDITIONAL JOBS

C	WILL BE RUN IF AND ONLY IF JOBERR(6) IS THE ONLY

C	JOBERR FLAG SET.

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	READ IN LINE CONTAINING BEGINNING OF JOB INFORMATION.

C

	READ (12,200) BEGTIM,JOBNUM,RUNBEG,JOBCRD

200	FORMAT ((I3,I2,I2,I5),I5,I6,L1)

C

C	THE VALUES READ IN ARE AS FOLLOWS:

C

C		BEGTIM	TIME & DATE AT BEGINNING OF JOB (I.E.,

C			WHEN JOB... WAS CALLED).  (SEE FORMAT

C			BELOW.)

C

C		JOBNUM	THE NUMBER OF THIS JOB WITHIN THE

C			CURRENT JOB FILE.  THE FIRST JOB IN

C			A JOB FILE HAS JOBNUM=1.  JOBNUM IS

C			INCREMENTED BY ONE FOR EACH SUBSEQUENT

C			JOB.

C

C		RUNBEG	ACCUMULATED JOB FILE RUN TIME WHEN THIS

C			JOB BEGAN.

C

C		JOBCRD	TRUE IF AND ONLY IF A $JOB CARD WAS

C			FOUND TO BEGIN THE JOB.

C

C	RUNBEG IS SUBTRACTED FROM RUNEND (READ IN AS PART OF

C	JOB TERMINATION MESSAGE) TO DETERMINE THE NET JOB RUN

C	TIME.

C

C	JOBCRD IS USED TO DETERMINE WHETHER OR NOT A $JOB CARD

C	MAY BE READ IN BY JOB....  IF JOBCRD IS TRUE, JOB...

C	READS IN THE $JOB CARD TO DETERMINE THE ACCOUNT

C	NUMBER TO WHICH THIS JOB WILL BE CHARGED.

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	READ IN INFORMATION FROM JOB QUEUE NODE:

C

	READ (12,300) FILTIM,JBNAM1,JBNAM2,JBID,DLTFLG,OPRFLG,

     1                FRCFLG,SEQFLG,UNUSED,HLDFLG,CCLFLG,

     2                UFDFLG,TIMEST,CLASS,MEMSIZ,SUBTIM,INDEV,

     3                INUNT,INUFD,LSTDEV,LSTUNT,LSTUFD,LGNDEV,

     4                LGNUNT,LGNUFD

300	FORMAT ((I3,I2,I2,I5),2A3,I6,8L1,I4,I1,I3,

     1          (I3,I2,I2,I5),3(A2,A2,A3))

C

C	THE VALUES READ IN ARE AS FOLLOWS:

C

C		FILTIM	TIME & DATE WHEN BATCH SELECTED THIS

C			JOB FILE FOR EXECUTION.  I.E., TIME

C			& DATE AT BEGINNING OF JOB FILE.

C			(SEE FORMAT BELOW.)

C

C		JBNAM1	JOB FILE NAME.  TWO WORDS, THREE

C		JBNAM2	CHARACTERS EACH.

C

C		JBID	JOB FILE SEQUENCE NUMBER OR JOB

C			ID (ASSIGNED BY QJOB DIRECTIVE).

C

C		DLTFLG	IF TRUE, JOB FILE WILL BE DELETED

C			AFTER IT IS EXECUTED.

C

C		OPRFLG	IF TRUE, AN OPERATOR MUST BE ON DUTY

C			WHEN THIS JOB IS RUN.

C

C		FRCFLG	IF TRUE, THIS JOB'S EXECUTION WAS

C			FORCED BY THE OPERATOR.

C

C		SEQFLG	IF TRUE, THIS JOB HAS BEEN SEQUENCED.

C

C		UNUSED	RESERVED

C

C		HLDFLG	SHOULD ALWAYS BE FALSE.

C

C		CCLFLG	SHOULD ALWAYS BE FALSE.

C

C		UFDFLG	IF TRUE, AN EXPLICIT LOGIN DISK, UNIT,

C			AND UFD WAS SPECIFIED.

C

C		TIMEST	JOB FILE TIME ESTIMATE OR TIME LIMIT.

C			ZERO IMPLIES THE DEFAULT (ASSEMBLY

C			PARAMETER TO BDRES) WILL BE USED.

C

C		CLASS	JOB CLASS.

C

C		MEMSIZ	MINIMUM CORE REQUIRED.  0 => 1K,

C			127 => 128K.

C

C		SUBTIM	TIME & DATE WHEN JOB WAS SUBMITTED.

C			(SEE FORMAT BELOW.)

C

C		INDEV	JOB INPUT FILE DEVICE, UNIT, AND UFD.

C		INUNT	INCLUDES TWO CHARACTER DEVICE NAME,

C		INUFD	TWO DIGIT UNIT NUMBER, AND THREE

C			CHARACTER UFD NAME.

C

C		LSTDEV	JOB LISTING FILE DEVICE, UNIT, AND

C		LSTUNT	UFD.  INCLUDES TWO CHARACTER DEVICE

C		LSTUFD	NAME, TWO DIGIT UNIT NUMBER, AND

C			THREE CHARACTER UFD NAME.

C

C		LGNDEV	LOGIN DEVICE, UNIT, AND UFD (IF

C		LGNUNT	SPECIFIED).  INCLUDES TWO CHARACTER

C		LGNUFD	DEVICE NAME, TWO DIGIT UNIT NUMBER,

C			AND THREE CHARACTER UFD NAME.

C

C	THE MAJORITY OF THE INFORMATION IN THIS MESSAGE IS

C	USED TO CALCULATE THE JOB PRIORITY (FOR SCHEDULING

C	PURPOSES), AND IS OF NO USE TO US HERE.

C

C	JBID AND SUBTIM, TAKEN TOGETHER, CONSTITUTE A UNIQUE

C	IDENTIFIER FOR THE JOB FILE.  THE JOB FILE SEQUENCE

C	NUMBER (JBID) IS ONE FOR THE FIRST JOB SUBMITTED

C	ON EACH DAY, AND IS INCREMENTED BY ONE FOR EACH

C	SUBSEQUENT JOB ON THE SAME DAY.

C

C	IF UFDFLG IS FALSE, INDEV, INUNT, AND INUFD WILL BE

C	TO LOGIN TO TDV.  IF THIS RESULTS IN AN ERROR, THE

C	SYSTEM DEFAULTS WILL BE USED (I.E., RESPOND TO TDV'S

C	LOGIN PROMPT WITH A NULL LINE).  IF UFDFLG IS TRUE,

C	AN EXPLICIT LOGIN DEVICE, UNIT, AND UFD HAS BEEN

C	SPECIFIED, AND THEREFORE LGNDEV, LGNUNT, AND LGNUFD

C	WILL BE USED.  IT THIS RESULTS IN AN ERROR, THE

C	JOB WILL BE TERMINATED.

C

C	IF LSTDEV IS '@@', THE DEFAULT LISTING DEVICE (THE LINE

C	PRINTER) WILL BE USED.

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	THROUGHOUT THIS PROGRAM, TIME & DATE IS REPRESENTED

C	IN A COMMON FORMAT.  THE TIME & DATE IS CONTAINED

C	IN A 4 ELEMENT INTEGER ARRAY.  ITS ENTRIES HAVE THE

C	FOLLOWING MEANING:

C

C		***TIM(1)	YEARS SINCE 1900 (I.E., ZERO

C				MEANS 1900).

C

C		***TIM(2)	MONTH (RANGE 1 TO 12).

C

C		***TIM(3)	DAY (RANGE 1 TO 31).

C

C		***TIM(4)	SECONDS SINCE MIDNIGHT (RANGE

C				0 TO 86399).

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	READ IN $JOB OR $END CARD, IF ONE IS AVAILABLE:

C

	IF (JOBERR(6) .OR. JOBERR(8)) READ (12,400) JOBLIN

400	FORMAT (132A1)

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	DETERMINE NET JOB RUN TIME, WHETHER OR NOT THIS

C	IS THE LAST JOB, AND THE CURRENT TIME:

C

	TIME=RUNEND-RUNBEG

	LAST=.FALSE.

	DO 500 I=1,17

500	IF (I .NE. 6) LAST=LAST .OR. JOBERR(I)

	HOUR=ENDTIM(4)/3600

	MIN10=MOD(ENDTIM(4),3600)/600

	MIN1=MOD(ENDTIM(4),600)/60

	SEC10=MOD(ENDTIM(4),60)/10

	SEC1=MOD(ENDTIM(4),10)

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	PRINT THE "JOB TERMINATED" MESSAGE ON THE OPERATOR'S

C	TERMINAL.

C

	WRITE (4,600) HOUR,MIN10,MIN1,SEC10,SEC1,ENDTIM(3),

     1                MONTHS(ENDTIM(2)),ENDTIM(1),TIME

600	FORMAT (' ',I2,':',2I1,':',2I1,' ',I2,'-',A3,'-',I2,

     1            '  BATCH -- JOB TERMINATED.  RUN TIME =',

     2            I6,' SECONDS.')

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	PRINT JOB TRAILER PAGE ON LISTING DEVICE, AND

C	LOG CAUSE OF JOB TERMINATION TO OPERATOR TERMINAL:

C

	WRITE (16,700)

700	FORMAT ('1',5(' XVM/RSX MULTIACCESS BATCH'),

     1          10(/,' ',5(' XVM/RSX MULTIACCESS BATCH')))

C

	WRITE (16,710) HOUR,MIN10,MIN1,SEC10,SEC1,ENDTIM(3),

     1                 MONTHS(ENDTIM(2)),ENDTIM(1),JOBNUM,

     2                 JBNAM1,JBNAM2,TIME

710	FORMAT (4(' ',/),

     1          ' ',I2,':',2I1,':',2I1,' ',I2,'-',A3,'-',I2,

     2            '  END JOB NUMBER',I6,' IN JOB FILE " ',

     3            2A3,' JOB ".  JOB RUN TIME =',I6,

     4            ' SECONDS.',/,

     5          ' ')

	I=17

C

	IF (JOBFND .NE. 0) GO TO 729

	I=I+3

	IF (JOBERR(6) .OR. JOBERR(7) .OR. JOBERR(9)) GO TO 725

	WRITE (16,720)

720	FORMAT (' ',/,

     1          ' ',20X,'JOB TERMINATED DURING INITIALIZATION',

     2            ' -- NO COMMANDS WERE PROCESSED',/,

     3          ' ')

	GO TO 729

725	WRITE (16,727)

727	FORMAT (' ',/,

     1          ' ',20X,'$JOB CARD NOT FOUND',/,

     2          ' ')

729	CONTINUE

C

	IF (JOBFND .NE. 2) GO TO 739

	I=I+3

	WRITE (16,730)

730	FORMAT (' ',/,

     1          ' ',20X,'JOB TERMINATED WHILE SCANNING FOR ',

     2            '$ERROR CARD (JOB HAS BEEN KILLED).',/,

     3          ' ')

739	CONTINUE

C

	ENCODE (10,INMSG,740) INDEV,INUNT

740	FORMAT ('E = ',2A2)

	J=-SKEV

	ENCODE (10,SKMSG,749) J

	ENCODE (10,LSTMSG,743) LSTDEV,LSTUNT

743	FORMAT (' = ',2A2)

	J=-NTREV

	ENCODE (10,NTRMSG,749) J

	J=LGNDEV

	K=LGNUNT

	TEMP='<UFD>'

	TEMP[7:27]=LGNUFD[0:20]

	IF (LGNDEV .NE. '@@') GO TO 745

	IF (LGNUNT .NE. '00') GO TO 745

	J='  '

	K='  '

745	IF (LGNUFD .NE. '@@@') TEMP='     '

	ENCODE (15,LGNMSG,747) J,K,TEMP

747	FORMAT (' = ',2A2,' ',A5)
	J=-INEV

	ENCODE (10,ERRMSG,749) J

	J=-WRTEV

	ENCODE (10,WRTMSG,749) J

749	FORMAT ('= -',O6)

C

	J=2

	DO 759 K=1,17

	L=ERRORS(J-1)+J-1

	IF (.NOT. JOBERR(K)) GO TO 759

	I=I+2

	WRITE (16,750) (ERRORS(M), M=J,L)

750	FORMAT (' ',/,

     1          ' ',20X,23A5)

	WRITE (4,755) (ERRORS(M), M=J,L)

755	FORMAT (' ',29X,23A5)

759	J=L+2

C

	IF (.NOT. LAST) GO TO 769

	I=I+5

	WRITE (16,760) HOUR,MIN10,MIN1,SEC10,SEC1,

     1                 ENDTIM(3),MONTHS(ENDTIM(2)),

     2                 ENDTIM(1),JBNAM1,JBNAM2,

     3                 RUNEND

760	FORMAT (4(' ',/),

     1          ' ',I2,':',2I1,':',2I1,' ',I2,'-',A3,'-',I2,

     2            '  END JOB FILE " ',2A3,' JOB ".  TOTAL ',

     3            'JOB FILE RUN TIME =',I6,

     4            ' SECONDS.')

769	CONTINUE

C

	IF (.NOT. DLTFLG) GO TO 779

	I=I+5

	WRITE (16,770)

770	FORMAT (4(' ',/),

     1          ' ',20X,'JOB FILE WILL BE DELETED AFTER ',

     2            'EXECUTION.')

779	CONTINUE

C

	I=I+5

	WRITE (16,780)

780	FORMAT (4(' ',/),

     1          ' ',5(' XVM/RSX MULTIACCESS BATCH'))

C

	DO 790 I=I,59

790	WRITE (16,795)

795	FORMAT (' ',5(' XVM/RSX MULTIACCESS BATCH'))

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

C	DETERMINE IF BATCH ACCOUNTING FILE EXISTS, ACCESS

C	THE ACCOUNTING FILE, THEN UPDATE THE ACCOUNTING

C	FILE WITH THE RUN TIME FROM THE JOB JUST FINISHED.

C

	TEMP='     '

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

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

	CALL WAITFR(I)

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

	WRITE (4,810)

810	FORMAT (' ',20X,'BATCH -- NO ACCOUNTING FILE.')

	GO TO 899

820	CALL DEFINE (13,407,1,FILNAM,J,0,0,0,I)

	CALL WAITFR(I)

	IF (I .GT. 0) GO TO 840

	I=-I

	WRITE (4,830) I

	WRITE (16,830) I

830	FORMAT (' ',19('*'),' BATCH -- ACCOUNTING FILE',

     1            ' ACCESS ERROR ',10('*'),/,

     2          ' ',19('*'),10X,'DEFINE EV = -',O6,10X,

     3            10('*'))

	GO TO 899

840	READ (13'1,ERR=850) JPDATE,ACTNUM,JOBS,RUNTIM

	JOBS(ACTNUM)=JOBS(ACTNUM)+1

	RUNTIM(ACTNUM)=RUNTIM(ACTNUM)+TIME

	WRITE (13'1,ERR=870) JPDATE,ACTNUM,JOBS,RUNTIM

	GO TO 899

850	WRITE (4,860)

	WRITE (16,860)

860	FORMAT (' ',19('*'),' BATCH -- ACCOUNTING FILE',

     1            ' READ ERROR ',10('*'))

	GO TO 899

870	WRITE (4,880)

	WRITE (16,880)

880	FORMAT (' ',19('*'),' BATCH -- ACCOUNTING FILE',

     1            ' WRITE ERROR ',10('*'))

899	CONTINUE

C

C	THE VALUES READ/WRITTEN FROM/TO THE ACCOUNTING

C	FILE ARE 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	CHECK IF THIS IS THE LAST JOB IN A JOB FILE AND,

C	IF IT IS, PRINT THE "END OF JOB FILE" MESSAGE

C	ON THE OPERATOR'S TERMINAL.

C

	IF (.NOT. LAST) GO TO 999

	WRITE (4,900) HOUR,MIN10,MIN1,SEC10,SEC1,ENDTIM(3),

     1                MONTHS(ENDTIM(2)),ENDTIM(1),JBNAM1,

     2                JBNAM2,RUNEND

900	FORMAT (' ',I2,':',2I1,':',2I1,' ',I2,'-',A3,'-',I2,

     1            '  BATCH -- END OF JOB FILE " ',2A3,

     2            ' JOB ".',/,

     3          ' ',29X,'TOTAL JOB FILE RUN TIME =',I6,

     4            ' SECONDS.')

999	CONTINUE

C

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

C

	END
