/ 
/ 
/                   FIRST PRINTING, FEBRUARY 1974
/ 
/ THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO 
/ CHANGE WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED
/ AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
/ DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPON-
/ SIBILITY FOR ANY ERRORS THAT MAY APPEAR IN THIS
/ DOCUMENT.
/ 
/ THE SOFTWARE DESCRIBED IN THIS DOCUMENT IS FUR-
/ NISHED TO THE PURCHASER UNDER A LICENSE FOR USE ON
/ A SINGLE COMPUTER SYSTEM AND CAN BE COPIED (WITH
/ INCLUSION OF DIGITAL'S COPYRIGHT NOTICE) ONLY FOR 
/ USE IN SUCH SYSTEM, EXCEPT AS MAY OTHERWISE BE PRO-
/ VIDED IN WRITING BY DIGITAL.
/ 
/ DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY
/ FOR THE USE OR RELIABILITY OF ITS SOFTWARE ON EQUIP-
/ MENT THAT IS NOT SUPPLIED BY DIGITAL.
/ 
/ COPYRIGHT (C) 1974, BY DIGITAL EQUIPMENT CORPORATION
/ 
/ 
        .EJECT
/    
/	EDIT #32	6/19/74		G. COLE
/					M. HEBENSTREIT
/			12/31/75	M. HEBENSTREIT
/    
/ COPYRIGHT 1973,  DIGITAL EQUIPMENT CORP., MAYNARD, MASS.  
/    
/	FILE BASED BATCH PROCESSOR FOR RSX PLUS III
/    
/    
/	THE BATCH PROCESSOR IS A SPECIALIZED PROGRAM WHICH APPEARS 
/	AS A TDV SYSTEM PROGRAM TO THE USER BUT AS AN I/O HANDLER TO
/	THE SYSTEM INTERNALLY.
/
/	BATCH IS INITIATED BY THE COMMAND   TDV>BATCH
/
/	UPON LOADING IT CONNECTS THE DEVICE NODE "BD0" TO
/	LOGICAL UNIT 12, SAVING THE ORIGINAL LUN12 ASSIGNMENT.
/	ASSIGNMENTS OF LUN12 AND LUN13 ARE TO THE TTY IN INTERACTIVE 
/	IT IS ASSUMED THAT LUN 12 WAS ASSIGNED TO THE TTY IN TDV MODE.
/
/	HAVING INITIALIZED ITSELF, BATCH PROCEEDS TO FIND A JOB 
/	WHICH NEEDS TO BE PROCESSED. THE QUEUE OF WAITING JOBS
/	IS MAINTAINED BY THE EXECUTIVE USING THE QJOB SYSTEM DIRECTIVE.
/	THIS QUEUE IS A STANDARD RSX DEQUE. ONE NODE IS LINKED FOR
/	EACH JOB PROCESSING REQUEST.
/
/	BATCH SCANS THIS ENTIRE LIST AND COMPUTES THE PRIORITY OF EACH
/	REQUEST. THE JOB WITH THE HIGHEST PRIORITY IS RUN NEXT.
/
/	THE BASIC ELEMENTS OF THE PRIORITY CALCULATION ARE THE FOLLOWING:
/	WAITTIME: DELAY BETWEEN NOW AND WHEN JOB WAS QUEUED IN MINUTES
/	TIMELIMIT: EXTIMATED RUNTIME OF THE JOB AS SPECIFIED ON THE $JOB
/	CLASS:A GENERAL PARAMETER INDICATING WHO IS ASKING FOR THE RUN
/	OPPRI:AN INDICATOR SET TO INDICATED THAT THIS JOB MUST RUN NEXT
/	OPREQ:AN INDICATOR SET TO INDICATE THAT THIS JOB NEEDS ASSISTANCE
/
/	THE FOLLOWING ADDITIONAL PARAMETERS ARE SUPPLIED BY THE
/	SYSTEM MANAGER OR ASSUMED BY BATCH(CURRENTLY THESE ARE ASSEMBLED IN)
/	TIMMAX:LONGEST JOB TO BE RUN AT THIS TIME OF DAY
/	CLSMIN:LOWEST CLASS JOB TO BE RUN AT THIS TIME OF DAY
/	WAIMAX:LONGEST TIME A JOB SHOULD WAIT REGARDLESS OF CHARACTERISTICS
/	OPON:AN INDICATOR SHOWING WHETHER OPERATOR ASSISTANCE IS NOW THERE
/	WFACTR:A MULTIPLIER APPLIED TO THE WAITING TIME
/	TFACTR:A MULTIPLIER APPLIED TO THE TIMELIMIT
/		TIMELIMIT IS EVALUATED IN REVERSE LOG(2) FORM
/		SO THAT 1 MIN BECOMES TIMELIMIT OF 9
/		AND 1023 MINUTES BECOMES TIMELIMIT OF 0
/		THUS TFACTR FAVORS THE SHORT JOB. THE LOG FORM IS
/		USED SO AS TO INCREASE DISCRIMINATION BETWEEN THE 
/		SHORTER RUN TIMES OF JOBS WHOSE INITIATORS ARE
/		PROBABLY WAITING AROUND FOR THE RESULTS.
/	CFACTR: MULTIPLIER FOR THE JOB CLASS
/
/	THE PRIORITY FORMULA IS
/
/	PRIORITY=CFACTR*CLASS + TFACTR*TIMELIMIT +WFACTR*WAITIME
/		IF<OPREQ.NE.OPON> PRIORITY=0
/		IF<WAITIME.GT.WAIMAX> PRIORITY=INFINITE
/		IF<OPPRI> PRIORITY=INFINITE
/		IF<TIMELIMIT.GT.TIMMAX> PRIORITY=0
/		IF<CLASS.LT.CLSMIN> PRIORITY = 0
/		IF<MEMSIZ.GT.TDVPAR-SIZE> PRIORITY = 0
/	IF<SPN.AND.<IF SPNPAR.NOT.FREE>> PRIORITY = 0
/
/
/
/	BATCH SELECTS THE JOB HAVING THE HIGHEST PRIORITY(NONZERO)
/	AND DEQUEUES THE JOB REQUEST DEQUE. IT EXTRACTS THE FILE
/	NAME, AND THE FILE DELETION FLAG. IT ALSO EXTRACTS
/	THE INPUT LOGICAL UNIT NUMBER FROM WHENCE THE FILE IS TO COME.
/
/	BATCH HINF'S THE INPUT LUN TO DETERMINE ITS CHARACTERISTICS.
/	IF THE DEVICE CANNOT DO INPUT THE MESSAGE 'JOB ACCESS ERR'
/	IS OUTPUT TO THE OPERATOR AND THE JOB IS
/	IGNORED AND THE NEXT JOB SELECTED.
/	ASSUMING THAT THE DEVICE CAN DO INPUT, BATCH DETERMINES IF IT IS
/	DIRECTORY ORIENTED. IF IT IS NOT, BATCH IMMEDIATELY ENTERS
/	THE MAINLINE HANDLER, READS THE FIRST RECORD, AND WAITS FOR 
/	SOMEONE(PRESUMABLY TDV) TO REQUEST IT.
/
/	IF THE DEVICE HAS A DIRECTORY, BATCH OPENS THE FILE
/	NAME SPECIFIED WITH THE EXTENSION 'JOB', IF THE FILE
/	CAN'T BE FOUND BATCH GIVES ANDOTHER 'JOB ACCESS ERR'
/	AND SKIPS THE JOB.
/	HAVING OPENED THE FILE BATCH ENTERS THE HANDLER PHASE.
/
/	WHEN THE JOB HAS BEEN PROCESSED, BATCH CLOSES THE FILE(IF OPENED)
/	IF THE DELETE INDICATOR HAS BEEN SET, BATCH DELETES THE FILE
/
/	THE BATCH GOES TO SELECT THE NEXT JOB TO RUN
/
/	WHEN THE OPR>EXIT COMMAND IS USED, BATCH FINISHES THE JOB 
/	FILE IN PROGRESS, TIMES OUT TO ALLOW IO TO COMPLETE, RESTORES
/	LUN 12 TO ITS ORIGINAL STATE, REQUESTS TDV... AND EXITS.
/	THE OPERATOR WILL SEE  TDV>  REAPPERAR AT THE CONSOLE.
/
/	THATS PHASE III BATCH! ENJOY IT.
/    
	.TITLE	PARAMETERS  
/    
R1=101	/RE-ENTRANT REGISTER 1 
R2=102	/RE-ENTRANT REGISTER 2 
R3=103	/RE-ENTRANT REGISTER 3 
R4=104	/RE-ENTRANT REGISTER 4 
R5=105	/RE-ENTRANT REGISTER 5 
VAJX=342  
NADD=107	/NODE ADD ROUTINE    
DQRQ=337	/DEQUEUE A REQUEST   
SNAM=123	/SEARCH FOR A NAME   
PDVL=252	/PHYSICAL DEVICE LIST
STKL=242	/SYSTEMS TASK LIST   
ATKL=244	/ACTIVE TASK LIST    
IOCD=345	/I/O COUNT DOWN 
DTMQ=361	/DEQUE ABORTED NODES 
POOL=240	/EMPTY POOL
PBDL=250	/PARTITION BLOCK LIST
NDEL=112
A.TS=7
A.RA=10
A.SN=6
S.DP=4
CURTSK=135	/CURRENT TASK ACTIVE TASK LIST POINTER 
TDVLN=201	/TDV TTY POINTER    
NAMCNT=33          /COUNT OF LEGAL BATCH COMMANDS 
X10=10    
X11=11    
.ENB=705521    
.INH=705522    
SS=163    
MM=164    
HH=165    
MO=166    
DA=167    
YR=170    
SSM=160		/LOCATION OF TIME IN SECONDS SINCE MIDNIGHT
LUT=142		/ADDRESS OF  POINTER TO LOGICAL UNIT TABLE
BCV=147		/ADDRESS OF POINTER TO BATCH COMMUNICATION VECTOR
HOLDON=40	/NUMBER OF DELAY PERIODS TO STAY IN CORE ON EXIT
DFTIME=4	/TIME LIMIT OF A JOB WITH 0 TIME SPECIFIED
MJOB1=323	/ADDRESS OF JOB HEADER IN MONITOR COMMUNICATION AREA
	.IFUND	CRLUN  
CRLUN=16  
	.ENDC    
	.IFUND	LOGDEV 
LOGDEV=15 
	.ENDC    
	.IFUND	LSTDEV 
LSTDEV=20 
	.ENDC    
	.IFUND	OPRDEV 
OPRDEV=100 
	.ENDC    
	.IFUND	STWAIT
STWAIT=1			/BEGIN IN A WAIT STATE
	.ENDC
	.TITLE BATCH HANDLER INITALIZATION
BD	LAC	(BD	/GET THE XR ADJUSTMENT FACTOR
	AND	(070000
	TCA
	DAC	XADJ	/SAVE THE ADJUSTMENT
	LAC	(STKL)	/SEARCH FOR THE ADDRESS
	DAC*	(R1)	/OF THE STL NODE OF TDV 
	LAC	(TDVNAM)	/SO THE READ REQUEST'S    
	DAC*	(R2)	/CAN BE CHECKED FOR TDV READ'S    
	JMS*	(SNAM)   
	CAL	(10)	/NOT FOUND EXIT NO TDV   
	DAC	TDVSTL	/SAVE THE POINTER TO TDV'S STL   
	LAC	(PDVL)	/SCAN PHYSICAL DEVICE LIST FOR NODE   
	DAC*	(R1)	/FOR THIS DEVICE   
	LAC	(HNAM)    
	DAC*	(R2)
	JMS*	(SNAM)   
	CAL	(10)	/NODE NOT FOUND EXIT
	DAC	PDVRQ	/EVENT VARIABLE ADDRESS IN PDVL NODE  
	LAC	(WFACTR)	/SET ADDRESS INTO BCV OF PARAMETERS
	DAC*	(BCV)
	LAC*	(LUT)	/GET ADRS OF LUN 12
	AAC	13
	DAC	LUNTMP	/SAVE ADDRESS OF LUN12
	LAC*	LUNTMP	/GET OLD CONTENTS OF LUN 12
	DAC	TDVTTY	/SAVE IT
	TAD	XADJ	/SET UP TO ACCESS PDVL NODE FORMERLY ASSOCIATED
	PAX		/WITH THE TDV TTY
	LAC	4,X	/IS LUN 12 'ATTACHED'?
	SNA
	JMP	.+4	/NO -- CONTINUE
	DZM	4,X	/YES -- ZERO THE ENTRY IN THE PDVL NODE
	DAC	LUNTMP	/SAVE THE ADDRESS OF ENTRY IN AFT TEMPORARILY
	DZM*	LUNTMP	/ZERO THAT ENTRY SO THE DEVICE IS REALLY DETACHED!
	LAC	PDVRQ	/GET ADDRESS OF BD NODE
	DAC*	LUNTMP	/ASSIGN IT TO LUN12
	AAC	10   
	DAC	PDVEV
	LAC	(TG) 
	DAC*	PDVEV    
	LAC*	(TDVLN)	/SAVE THE TDV TTY NUMBER  
	DAC	TDVSAV    
	LAC	(22)	/SET UP THE TDV NUMBER SO ^T DOESN'T WORK    
	DAC*	(TDVLN)  
	CAL	XFCTDV	/MAKE TDV HAPPY!
	CAL	REQTDV	/REQUEST TDV TO GET BATCH STARTED
	CAL	WRSTR	/PRINT OUT A LINE FEED
	JMP	GETJOB		/FIND A FILE TO PROCESS AND PREPARE IT!
/    
HNAM	.SIXBT	"BD@@@@"	/HANDLER TASK NAME 
XFCTDV	37
	0
	BD
	0	/THIS IS A CERTAIN ERROR FOR XFC, BUT CLEARS FLAGS
TDVNAM	.SIXBT	"TDV..."	/TDV NAME   
TDVTTY	0
LUNTMP	0
	.BLOCK	50-HNAM
	.TITLE	SELECT NEXT JOB TO RUN
GETJOB	LAC	QUEOJ	/IS IT BEING ENDED
	SZA
	JMP	ENDJOB	/IS NOW..
 
NXTJOB	LAC	EXJOB	/TEST THE BATCH PAUSE AND EXIT SWITCH
	SZA		/SKIP IF OK TO RUN A JOB
	JMP	NOJOBS	/JMP IF IN PAUSE OR EXIT CONDITION
	DZM	DLFSW	/CLEAR THE 'DELETE AFTER RUNNING' SWITCH
	LAC*	(MJOB1)	/LOOK AT THE MONITOR JOB QUEUE
	SAD	(MJOB1)	/IS IT EMPTY
	JMP	NOJOBS	/YES, GOTO SLEEP
/
/
/GET THE CURRENT SIZE OF THE TDV PARTITION INTO TDVSIZ
/AND WHETHER THER IS A FREE SPNJOB PARTITION INTO SPNFLG
/
/
EXTCHK	CAL	TDVINF
	LAC	TDVSIZ
	CLL
	LRS	12
	DAC	TDVSIZ	/DIVIDE BY 1K TO GET PAR SIZE IN K
	DZM	SPNFLG	/CLEAR SPNFLG(SET IF SPN IMPOSSIBLE
 
	LAC	(PBDL)	/ADDRESS OF PARTITION BLOCK LIST HEAD
	DAC*	(R1)	/
	LAC	(SPNAME)	/ADDRESS OF PARTITION TO BE FOUND
	DAC*	(R2)
	JMS*	(SNAM)	/GO FIND IT
	JMP	NOSPN	/NOT IN SYSTEM, LEAVE SPNFLG=0
	AAC	10		/GOTO FLAGS WORD IN PARTITION BLOCK
	DAC	TEMP
	LAC*	TEMP	/WILL BE NEG IF PAR OCCUPIED
	SPA
NOSPN	ISZ	SPNFLG	/SET FLAG IF PAR BUSY
 
CLRFLG	DZM	BESTPR	/CLEAR BEST PRI SWITCH
	DZM	BESTND	/CLEAR BEST NODE ADDRESS
	DZM	JOBFND	/CLEAR JOB FOUND FLAG
	LAW	-HOLDON	/RESET WAIT TIME FOR NOJOB CONDITION
	DAC	WAIJOB	/NEG OF NUM SECS TO WAIT FOR A JOB
 
	LAC*	(MJOB1)
SCANJ	DAC	JOBND	/SAVE ADDRESS OF JOB NODE
	JMS	PRIORI	/COMPUTE THIS ONES PRIORITY
	LAC*	JOBND	/LOOP TO NEXT QUEUE ENTRY
	SAD	(MJOB1)	/THIS IS THE LAST ENTRY
	JMP	SELJOB	/START PROCESSING
	JMP	SCANJ	/KEEP LOOKING
			/AT THIS POINT BESTND CONTAINS THE NODE ADDRESS
			/OF THE BEST JOB TO ROUN BAISED ON THE 
			/PRIORITY CRITERIA.
SELJOB	LAC	BESTND
	SNA
	JMP	NOJOBS	/CANT RUN ANY OF THEM!
	IAC
	DAC	PREVND	/ADDRESS OF POINTER TO PROVIOUS NODE IN THE LIST
	.INH		/PREVENT INTERRUPTS DURING BQJ LIST PROCESSING
	LAC*	PREVND	/ADDRES OF PREV NODE IN AC
	DAC	PREVND	/SAVE
	LAC*	BESTND	/PUT ADR OF NEXTNODE  INTO PREVND
	DAC*	PREVND
	IAC		/COMPUTE ADDRESS OF SECOND WORD IN NEXT NODE
	DAC	TEMP
	LAC	PREVND	/GET ADDRESS OF PREVIOUS NODE AND PUT INTO
			/BACKWARD POINTER OF NEXT NODE
	DAC*	TEMP
	.ENB
			/THE NODE HAS BEEN REMOVED FROM THE 
			/LIST OF WAITING JOBS AND IS NOW UNATTACHED
 
/EXTRACT DATA FROM NODE
 
	LAC	BESTND	/ADDRESS OF THE NODE
	AAC	2
	DAC	TEMP
	LAC*	TEMP	/FIRST WORD OF FILE NAME
	DAC	OPNF1
	DAC	CLSF1
	DAC	DELF1
	ISZ	TEMP
	LAC*	TEMP	/SECOND WORD OF THE FILE NAME
	DAC	OPNF2
	DAC	CLSF2
	DAC	DELF2
	ISZ	TEMP	/SKIP PRIORITY OF REQ
	ISZ	TEMP	/LOOK AT LUN ASSIGNMENT
	LAC*	TEMP	/GET INLUN/OUTLUN
	SWHA		/GET INLUN
	AND	(777)
	DAC	OPNLUN
	DAC	CLSLUN
	DAC	DELLUN
	DAC	HNFLUN
	DAC	USRLUN	/INTO BCV
	DAC	READCD+2	/ALSO INTO READ RECORD CAL BLOCK FOR 
				/INPUTING FILE.
	ISZ	TEMP
	LAC*	TEMP		/GET THE JINFO WORD
	DAC	DLFSW	/IF NEG, MEAND TO DELETE FILE AFTERWARD
	ISZ	TEMP	/PAST SP1
	ISZ	TEMP	/PASS SP2
	ISZ	TEMP	/ACCESS IDENT WORD(TIME WHEN QUEUED)
	LAC*	TEMP	/GET THIS TIME
	DAC	IDENT	/SAVE AS THE JOB IDENT
 
/RETURN THE NODE TO THE POOL
 
	LAC	(POOL)
	DAC*	(R1)
	LAC	BESTND
	DAC*	(R2)
	JMS*	(NADD)
	LAC	OPNLUN	/TEST LUN NUMBER FOR ZERO
	SNA
	JMP	NXTJOB	/IF SO,CANCEL THE JOB
 
/DETERMINE TYPE OF DEVICE BEING USED FOR INPUT
 
	CAL	HNFCPB	/HINF!
	CAL	WFEV
	LAC	EV
	AND	(200000)	/CAN IT DO INPUT?
	SZA			/SKIP IF NOT
	JMP	CHKFS		/YES, CHECK OF FILE STRUCTURE
JOBER1	JMS	ERRORP		/NO, PRINT OUT THE MESSAGE
	ACSERR			/'JOB ACCESS ERR'
	JMP	NXTJOB		/TRY ANOTHER JOB
 
CHKFS	LAC	EV
	AND	(40000)		/DOES IT HAVE A FILE STRUCTURE?
	DAC	FODSW		/KEEP THE FACT AROUND
	CAL	WAIT20		/GO IDLE FOR 20 TICKS
	CAL	WFEVMK		/TO ALLOW ABORTS TO OCCUR
	CAL	REQTDV
	DZM	FICLS	/INDICATE OPEN FILE
 
	LAC	FODSW		/SHOULD WE OPEN A FILE
	SNA
	JMP	WFTGR		/NO, BEGIN READING JOB...........
 
	CAL	OPNCPB
	CAL	WFEV		/OPEN THE JOB FILE
	LAC	EV
	SPA
	JMP	JOBER1		/CANT DO IT
	JMP	WFTGR		/NOW BEGIN TO RUN THE JOB.........
 
NOJOBS	LAC	EXJOB	/GET THE RUN/PAUSE/EXIT SWITCH
	SMA		/IF IN EXIT MODE, CONTINUE COUNTDOWN
	JMP	DELAYJ	/IF IN PAUSE MODE, KEEP WAITING
	ISZ	WAIJOB	/INCREMENT COUNTER TOWARD ZERO
	JMP	DELAYJ		/NOT READY
	JMP	DAEX	/RETURN CONTROL TO TDV
 
DELAYJ	CAL	MARKT	/WAIT FOR 1 SEC
	CAL	WFEVMK
 
	JMP	NONDFA	/AFER WAITING, LOOK FOR ANY REQUEST NODES TO PROCESS
			/WHEN ALL ARE DONE, NONODE GOES TO GETJOB
			/WHICH CHECKS FOR JOBS TO PROCESS
			/IF NONE WAITING, GETJOB GOES TO NOJOBS
			/WHICH INCREMENTS THE TIME COUNT
			/AND THEN EITHER EXITS BATCH MODE OR
			/COMES HERE TO DELAYJ TO REPEAT THE SEQUENCE
MARKT	13
	EVMK
	10
	1
 
WFEVMK	20
	EVMK
 
EVMK	0
 
WAIJOB	-HOLDON
 
TDVINF	26	/CPB TO GET SIZE OF TDV PARTITION
	0
	.SIXBT	/TDV@@@/
	.+1	/ADDRESS OF INFO BUFFER
	0
TDVSIZ	0	/WILL ACTUALLY KEEP SIZE IN K
 
SPNAME	.SIXBT	/SPNJOB/
 
SPNFLG	0	/SET IF SPAWNING IS IMPOSSIBLE
 
 
WAIT20	13	/WAIT FOR 1/3 SEC TILL LOOKING FOR ANOTHER JOB TO RUN
	EVMK
	20
	1
 
	.TITLE	END OF JOB PROCESSING
 
ENDJOB	LAW	-1
	DAC	FICLS		/INDICATE THAT FILE IS CLOSED
	DZM	QUEOJ
	CAL	REQEND
	LAC	FODSW		/WAS THERE A FILE?
	SNA			/
	JMP	GETJOB		/NO, NOTHING TO DO
 
	CAL	CLSCPB		/YES, CLOSE IT
	CAL	WFEV
	LAC	EV
	SPA
	JMP	JOBER2		/CANT CLOSE THE FILE
 
/NOW RENAME THE FILE BACK TO A SRC EXTENSION SO THAT THE USER CAN RUN IT
/AGAIN IF HE DESIRES, ALSO SERVES AS AN INDICATION THAT IT IS DONE.
 
 
	LAC	DLFSW	/SHOULD WE DELETE THE FILE?
	SMA
	JMP	NXTJOB	/NO, GO GET NEXT JOB
	CAL	DELCPB	/YES
	CAL	WFEV
	LAC	EV
	SMA		/TEST FOR AN ERROR
	JMP	NXTJOB	/NO, RUN THE NEXT JOB
JOBER2	JMS	ERRORP	/YES, PRINT ERROR MESSAGE
	CLSERR		/'JOB FINISH ERR'
	JMP	NXTJOB	/PROCESSNEXT JOB
	JMP	JOBER2
	JMP	NXTJOB	/OK, ALL DONE
	.TITLE	CALCULATE JOB PRIORITY AND URGENCY
 
PRIORI	0	/THIS SUBROUTINE IS ENTERED WITH THE NODE ADDRESS
		/IN THE AC
		/IT MAINTAINS TWO WORDS, BESTND AND BESTPR
 
/EXTRACT DATA IN JOB NODE
 
	DAC	NDT	/ADDRES OF NODE
	AAC	11
	DAC	TEMP	/ADDRESS OF TIME WHEN QUEUED
	LAC*	TEMP
	TCA
	DAC	TEMPP
 
			/GET CORRECT TIME IN SECONDS SINCE MIDNIGHT
 
	LAC*	(SSM)	/
	TAD	TEMPP	/SUBTRACT STORED TIME
	SPA		/IF NEG ADD ONE DAY!
	.DEC
	TAD	(86400)/ NUMBER OF SEC IN DAY
	.OCT
	CLL		/CLEAR THE LINK!!
	LRS	6	/DIVIDE BY 64 (1 SEC APPROX)
	SNA
	IAC
	DAC	WAITM	/SAVE AS WAITING TIME
 
/COMPUT THE JOB TIME LIMIT IN A  CODED FORM
/THIS IS  01-LOG(2) TIMELIMIT
/RESULT IS A NUMBER FORM 9 TO 0
/9 IS SHORT JOB -- 1 MIN
/0 IS LONG JOB -- >1024 MIN
/THIS FORMAT IS CHOSEN SO THAT SMALL TIMES GAIN 
/APPRECIABLE PRIORITY OVER LONG ONES.
 
	LAC	NDT	/ADDRESS OF JOB NODE
	AAC	6
	DAC	JINFO
	IAC		/ADDRESS OF NEXT WORD
	DAC	SP1W	/SAVE FOR FREQUENT REFERENCE
	LAC*	JINFO
	AND	(1777)	/EXTRACT 10 BIT TIME LIMIT
	SNA
	LAC	(DFTIME)	/THIS IS THE DEFAULT IME LIMIT IF
						/IF NONE IS SPECIFIED IN THE QUEUE ENTRY
	DAC	TIMEST	/SAVE THE TIME ESTIMATE FOR THE JOB
	NORM	/NORMALIZE TH TIME
	LACS		/BRING THE STEP COUNT INTO THE AC
	AAC	-41	/MAKE BIT 10 WORTH 0
	DAC	TIMLM	/THIS IS THE COMPUTED TIME LIMIT
/
/MAKE TESTS FOR SPAWNING,HOLDING,OPERATOR,AND MEMORY SIZE
/
SPNTST	LAC*	JINFO	/GET SPN FLAG
	AND	(20000)
	SNA
	JMP	HLDTST	/NOT SPNED
	LAC	SPNFLG	/IS SPN POSSIBLE NOW?
	SZA		/SKIP IF SO
	JMP	NORUN	/JMP IF NOT
HLDTST	LAC*	JINFO	/TEST FOR HOLD BIT OR CCL BIT
	AND	(14000)
	SZA
	JMP	NORUN	/SORRY, ONE OF THEM IS SET
OPRTST	LAC*	JINFO
	AND	(200000)	/IS OPR REQUIRED?
	TAD	OPON	/IS HE HERE?
	SAD	(200000)	/IF NEEDED BUT NOT HERE
	JMP	NORUN		/CANNOT RUBN THE JOB
MEMTST	LAC*	SP1W		/EXTRACT MEMORY SIZE NEEDED
	AND	(177)
	SNA
	JMP	SEQTST		/IF ZERO , ANY SIZE WILL DO
	CMA			/GET SIZENEEDED-1 IN K
	TAD	TDVSIZ		/ADD SIZE AVAIL IN K
	SPA			/SKIP IF OK(GT OR EQ)
	JMP	NORUN
/
/TEST FOR JOB SEQUENCING
/
/IF THE SEQUENCE BIT IS SET, THIS JOB MAY NOT BE RUN UNTIL
/	ALL PREVIOUSLY SUBMITTED SEQUENCED JOBS HAVE BEEN RUN
/	SINCE THE JOB DEQUE IS ORDERED  IN REVERSE ORDER OF
/	ENTRY, TO TEST FOR A SEQUENCE HOLD WEE NEED ONLY TEST EVERY 
/	SUBSEQUENT JOB DEQUE ENTRY, IF ANY ARE SEQUENCED, THIS 
/	JOB CANNOT BE RUN.
/
SEQTST	LAC*	JINFO
	AND	(40000)	/EXTRACT SEQUENCING BIT
	SNA
	JMP	FORTST	/NOT SET
	LAC*	JOBND	/GET ADDRESS OF NEXT JOB NODE
SEQLOP	DAC	TEMP	/SAVE IT
	SAD	(MJOB1)	/IS THIS THE END OF THE LIST
	JMP	FORTST	/YES, AND NO SEQUENCED JOBS WERE FOUND
	AAC	6	/CREATE ADDRESS OF JINFO WORD IN NODE
	DAC	TEMPP
	LAC*	TEMPP
	AND	(40000)	/TEST THIS JOB FOR SEQUENCING
	SZA		/SKIP IF NOT
	JMP	NORUN	/CURRENT JOB CANNOT BE RUN NOW
	LAC*	TEMP	/POINTER TO NEXT JOB DEQUE ENTRY
	JMP	SEQLOP
 
 
/
/
/TEST FOR JOB FORCING,TIME LIMIT TOO LONG,CLASS TOO LOW,WAIT TOO LONG
/
FORTST	LAC*	JINFO
	AND	(100000)	/EXTRACT FORCE BIT
	SZA
	JMP	RUNOW		/MUST RUN NOW!!
 
TIMTST	LAC	TIMEST	/GET EST TIME
	TCA
	TAD	TIMMAX		/MAXIMUM ALLOW TIME
	SPA		/ALLOWED IF SKIPING
	JMP	NORUN
 
CLSTST	LAC*	SP1W	/EXTRACT CLASS
	AND	(700000)
	CLL!RTL; RTL	/ROTATE IT AROUND THE END
	DAC	CLSLM	/SAVE FOR PRIORITY CALCULATION
	TCA
	TAD	CLSMIN	/MUST BE ABOVE MIN
	SMA!SZA		/SKIP IF NEG OR ZERO
	JMP	NORUN
 
WAITST	LAC	WAITM	/WAITING TIME
	TCA
	TAD	WAIMAX
	SPA
	JMP	RUNOW	/RUN NOW IF WAIT GTR MAX
 
 
/
/
	.EJECT
/COMPUTE THE PRIORITY FOR THIS JOB
 
 
 
CMPRI	LAC	WFACTR	/TEMP=WFACTR*WAITM
	DAC	.+4
	LAC	WAITM
	CLL
	MUL
	0
	DAC	TEMP
 
	LAC	TFACTR	/TEMP=TEMP+TFACTR*TIMLM
	DAC	.+4
	LAC	TIMLM
	CLL
	MUL
	0
	LACQ
	TAD	TEMP
	DAC	TEMP
 
	LAC	CFACTR	/TEMP=TEMP+CFACTR*CLSLM
	DAC	.+4
	LAC	CLSLM
	CLL
	MUL
	0
	LACQ
	TAD	TEMP
	AND	(377777)	/INCASE OF OVERFLOW
	DAC	TEMP
 
	JMP	TESTP	/IF JOB HAS SURVIVED TO HERE, SEE IF ITS THE BEST
 
 
 
NORUN	JMP*	PRIORI	/MUST RUN SOMEONE ELSE
 
RUNOW	LAC	(377777)
	DAC	TEMP	/MAKE PRIORITY INFINITE!!
	JMP	TESTP
 
TESTP	LAC	BESTPR	/IS THIS JOB MORE URGENT THAN THE LAST ONES?
	TCA
	TAD	TEMP
	SPA
	JMP*	PRIORI	/NO
 
	LAC	TEMP	/YES!! MAKE THIS THE BEST JOB TO RUN
	DAC	BESTPR
	LAC	NDT
	DAC	BESTND	/
	JMP*	PRIORI
	.TITLE	VARIABLES AND DATA FOR JOB SELECTOR
OPNCPB	3200
	EV
OPNLUN	0
OPNF1	0
OPNF2	0
	.SIXBT	/JOB/
 
CLSCPB	3400
	EV
CLSLUN	0
CLSF1	0
CLSF2	0
	/SIXBT	/JOB/
 
 
DELCPB	3500
	EV
DELLUN	0
DELF1	0
DELF2	0
	.SIXBT	/JOB/
 
 
TEMPP	0
////****** DO NOT REORDER ANY WORDS THAT FOLLOW 
////******  THIS IS THE BATCH COMMUNICATION VECTOR
WFACTR	1	/MULTIPLIER FOR WAIT TIME
TFACTR	10	/MULTIPLIER FOR TIME LIMIT
CFACTR	1	/MULTIPLIER FOR JOB CLASS
OPON	1	/OPERATOR ON/OFF INDICATION <ON>
TIMLM	0
WAITM	0
CLSLM	0
WAIMAX	74	/MAX TIME A JOB SHOULD WAIT <1 HR>
TIMMAX	1777	/LONGEST JOB ALLOWED TO RUN <1023 MIN>
CLSMIN	0	/LOWEST CLASS ALLOW TO RUN
QUEOJ	0	/SET WHEN END OF FILE REACHED
FICLS	-1	/SET WHEN FILE CLOSED
EXJOB	STWAIT	/SET 1 TO PAUSE AT EOJ, 0 TO RUN JOBS, -1 TO EXIT BATCH
USRLUN	0	/CONTAINS LUN NUMBER OF CURRENT JOB FILE
JOBFND	0	/SET TO ONE WHEN $JOB CARD FOUND
		/SET TO ZERO WHEN $END CARD FOUND
		/SET TO 0 WHEN TIME LIMIT IS EXCEEDED
		/AT EOJ. DOES NOT INTERFERE WITH INTRA-JOB OPERATION.
PAUSW	0	/SET TO 1 WHEN IN A PAUSE 0 WHEN NOT
IDENT	0	/ID NUMBER OF CURRENT JOB
TLEMOD	0	/STATUS OF THE OVERRUN SYSTEM
		/0 MEANS NORMAL JOB RUNNING,NOT REACHED TIME ESTIMATE
		/1 MEANS ESTIMATE EXCEEDED, NOT REACHED LIMIT
TLEACT	3	/TYPE OF ACTION TO BE INITIATED WHEN OVERRRUN OCCURS
			/
		/NOT ALL OPTIONS ARE IMPLEMENTED
		/1: ABORT ON TLE
		/2: KILL ON TLE
		/3: STOP ON TLE
		/4: REPORT ON TLE
		/5: IGNORE TLE
////****** DO NOT REORDER ANY WORDS WHICH PRECEDE
////****** THIS WAS THE BATCH COMMUNICATION VECTOR
OPREQ	0	/OP REQUIRED FLAG
OPPRI	0	/OPERATOR PRIORITY FLAG
TIMEST	0	/TIME ESTIMATE FOR THIS JOB
SP1W	0	/HOLDS ADDRESS OF SP1 WORD IN JOB NODE
DLFSW	0	/DELETE THIS FILE SWITCH
BESTPR	0
BESTND	0
JOBND	0
PREVND	0
FODSW	0
NDT	0
JINFO	0
/
/
/
/BATCH ERROR MESSAGE HANDLING:
/SUBROUTINE ERRORP
/
/	JMS	ERRORP
/	ADRS
/
/	ADRS IS ADDRESS OF LINE BUFFER HEADER OF MESSAGE TO BE PROINTED
/
/THE MESSAGE IS PRINTED ON THE OPR DEV AND ON THE LSTDEV
/
ERRORP	0	/ENTRY, AC IGNORED
	LAC*	ERRORP	/GET ARGUMENT
	ISZ	ERRORP	/PREPARE TO RETURN
	DAC	WRIERR+4	/ADDRESS OF LINE TO PRINT
	LAC	(LSTDEV)	/OUTPUT TO LIST FILE
	DAC	WRIERR+2	/LUNSETUP
	CAL	WRIERR
	LAC	(OPRDEV)	/OUTPUT TO OPERATOR
	DAC	WRIERR+2
	CAL	WRIERR
	CAL	WFEV	/WAIT FOR THE OPERATOR PRINTOUT
	JMP*	ERRORP	/RETURN TO CALLER
 
WRIERR	2700	/CPB FOR ERROR PRINTOUTS
	EV
	0	/LUN
	2	/ASCII MODE
	0	/LINE BUFFER ADDRESS
 
/BATCH ERROR MESSAGES
 
ACSERR	004002	/WHEN JOB FILE CANT BE OPENED
	0
	.ASCII	"JOB ACCESS ERR"<015>
 
CLSERR	004002
	0
	.ASCII	"JOB FINISH ERR"<015>
 
WRNTSK	004002	/WHEN A REQUESTING TASK CANNOT BE ABORTED
	0	/OR IS RUNNING HIGHER IN PRI THAN BATCH
	.ASCII	"WRNG TSK - ABT"<015>
 
BDCERR	004002	/WHEN A ILLEGAL CONTROL CARD IS SEEN
	0
	.ASCII	"UNK $CARD ERR"<015>
 
READLR	004002
	0
	.ASCII	"READ $CARD ERR"<015>
 
	.EJECT
HNFCPB	3600
	EV
HNFLUN	0
	.TITLE	BD HANDLER MAIN  
WFTGR	JMS	WAJOB	/WAIT TILL JOB PRINTOUT DONE 
	CAL	READCD	/READ AND INPUT CARD   
	CAL	WFEV	/WAIT FOR EVENT VARIABLE 
	LAC	EV	/CEHCK EVENT VARIABLE 
	JMS	BDRD	/CHECK FOR VALID READ, SET QUEOJ IF ERROR
NONDF	CAL	WFTCPB	/WAIT FOR TRIGGER 
NONDFA	DZM	TG	/CLEAR THE TRIGGER   
	LAC	(NOP)	/SET UP ABORT TO A NOP  
NODFZ	DAC	ABTSKP    
	LAC	PDVRQ	/SET UP TO DEQUEUE A NODE    
	DAC*	(R1)
	JMS*	(DQRQ)   
	JMP	NONODE	/NO NODE FOUND
	DAC	RN	/SAVE NODE ADDRESS    
RETRA	TAD	XADJ	/ADD IN XR ADJUSTMENT    
	PAX 
	JMS	DELLF
	LAC	6,X	/SAVE ADDRESS OF REQUESTOR'S EVENT VARIABLE   
	SNA 
	LAC	(RE)	/NO USER'S EVENT VARIABLE
	DAC	RE   
	LAC	5,X	/FETCH CAL CODE 
	AND	(777)	/MASK OFF FUNCTION CODE 
	SAD	(26)	/IS IT A READ? 
RDRQ	JMP	RDCD	/YES, PROCESS THE CARD
			/LAST CARD READ. 
	SAD	(17)	/ABORT?   
	JMP	ABORT	/YES ABORT I/O FOR THIS TASK 
	SAD	(36)	/HINF?    
	JMP	HINF	/YES HANDLER INFORMATION 
SEVM6	LAW	-6	/UNIMPLEMENTED FUNCTION    
	JMP	SEV	/RETURN -6 EVENT VARIABLE 
/
/CHECK TO SEE IF FILE CLOSED WHEN  FINDING  NO NODE TO PROCESS,
/IF FILE IS CLOSE, PROBABLY IT IS A MARK ON THE TEV 
/THAT WOULD HAPPEN IF WE ARE WAITING AROUND IN CORE HOPING A
/JOB WILL COME. HENCE IF FILE CLOSED GOTO GETJOB!
/IF FILE IS OPEN IGNORE THE TRIGGER AND GOTO NONDF
NONODE	LAC	FICLS
	TAD	QUEOJ
	SNA	/SKIP IF FICLS IS NONE ZERO, IE FILE IS CLOSED
	JMP	NONDF	/FILE OPEN, IGNORE
	JMP	GETJOB	/ITS TIME TO LOOK AROUND!
/
/
/
	.EJECT
/    
/	ABORT -ABORT I/O FOR THE CALLED TASK  
/    
ABORT	XOR	5,X	/LEGAL ONLY FOR LUN 0
	SZA 
	JMP	SEVM6	/-6 FOR ALL OTHERS 
	LAC	PDVRQ	/GO REMOVE NODES FROM QUEUE  
	DAC*	(R1)
	LAC	RN   
	DAC*	(R2)
	JMS*	(DTMQ)	/EMPTY QUEUE
	LAC	(SKP)	/DON'T READ ANOTHER CARD
	DAC	ABTSKP    
	JMP	REQCMP	/FINISHED RETURN NODE TO POOL    
/    
/    
/	DAEX DETACH BATCH DEVICE AND CLEAR TRIGGER AND RESET 
/	^T TTY  
/    
DAEX	LAC	TDVSAV	/RESTORE TDV TTY NUMBER 
	DAC*	(TDVLN)  
	DZM*	(BCV)	/DISSCONNECT THE BATCH COMMUNICATION VECTOR
	DZM*	PDVEV	/CLEAR THE TRIGGER
	LAC	TDVTTY
	DAC*	LUNTMP
	CAL	REQTDV	/RESET THE LOGICAL UNIT TABLE AND CALL TDV
	CAL	(10)	/EXIT
/    
HINF	LAC	(SKP)	/SET UP NOT TO READ A CARD    
	DAC	ABTSKP    
	LAC	(200021) /BATCH DEVICE HANDLER INFORMATION   
	JMP	SEV	/SET EVENT VARIABLE  
/    
/    
RDCD	LAC	FICLS	/ZERO IF FILE OPEN
	TAD	QUEOJ	/ZERO IF NO ERROR
	SZA		/BOTH FLAGS GO NEG ON ERROR
	JMP	NABMSG	/CANNOT PROCESS THIS REQUEST!!!
	LAC	BD+2	/TEST FOR SPECIAL CONTROL RECORDS
	SAD	ERR1	/CHECK FOR $ERROR
	JMP	ERRIT
	SAD	QUIT1	/CHECK FOR $QUIT(PHYSICAL EOF)
	JMP	QUITA
	LAC	JOBFND	/IS A JOB RUNNING CORRECTLY
	SPA!SNA		/SKIP IF JOBFND IS GTR 1
	JMP	LGRTN	/NOT ANY OF THE FOLLOWING WILL BE CHECKED
	LAC	BD+2	/TEST SOME MORE
	SAD	MSG1	/$MSG RECORDS GET TYPED OUT TO OPR AND LPT
	JMP	MSGIT
	SAD	LOG1
	JMP	LOGIT	/$LOG RECORDS GET PRINTED ON THE LPT
	SAD	PAU1
	JMP	PAUSE	/$PAUSE RECORDS GET TREATED GENTLY
LGRTN	LAC	2,X	/CHECK FOR READ TDV  
	SAD	TDVSTL	/IS THIS TDV?
	JMP	STLRD	/YES READ OF TDV IS SPECIAL  
	LAC	BD+2	/CHECK FOR $EOF CARD
	SAD	(222131)	/$EO? 
	SKP 
	JMP	NTRDEF	/NO CONTINUE 
	LAC	BD+3 
	AND	(777400) /OF?  
	SAD	(743000)  
	JMP	RDEOFF	/YES RETURN END OF FILE HEADER   
NTRDEF	LAC	BD+2	/PICK UP THE FIRST WORD 
	AND	(774000) /OF THE CARD AND MASK 1ST CHAR 
	SAD	(220000) /IS IT A $?
	JMP	CNTLCD	/YES -- GO HANDLE CONTROL CARD ERROR  
RDEF	LAC	11,X	/NO -- SET UP TO VALADATE AND ADJUST
	DAC*	(R4)
	DAC	TEMPA
	LAC	10,X	/USER'S BUFFER AREA 
	DAC*	(R3)
	LAC	7,X  
	SAD	(2)	/IOPS ASCII ONLY LEGAL    
	SKP 
	JMP	ERM7	/ILLEGAL DATA MODE  
	LAC	RN   
	DAC*	(R2)
	JMS*	(VAJX)	/VALADATE AND ADJUST  
	JMP	ERM30	/PROTECT VIOLATION 
	LAC	BD	/FIND THE WORD COUNT  
	SWHA
	AND	(177)
	CLL!RAL  
	TCA 
	DAC	TEMP 
	TAD	TEMPA	/CHECK TO SEE IF IT FITS
	SPA 
	JMP	INCRCL	/NO FIT ERROR
STOR	LAC	(BD-1)	/SET UP TO TRANSFER
	DAC*	(X10)	/THE CARD TO THE USER'S BUFFER   
	LAC*	(R3)
	AAC	-1	/SUBTRACT 1 FROM USER'S BUFFER POINTER FOR AUTO XR  
	DAC*	(X11)    
	LAC*	X10	/TRANSFER 
	DAC*	X11 
	ISZ	TEMP	/FINISHED?
	JMP	.-3	/NO TRY AGAIN   
	JMP	REQCMP	/YES -- RETURN EV +2   
/    
PAUSE	LAC	BD+3 
	AND	(777400)	/CHECK SECOND HALF OF REQUEST  
	SAD	PAU2 
	SKP 
	JMP	LGRTN	/NOT LOGOR PAUSE CONTINUE    
	CAL	WRITE2	/PAUSE WRITE IT ON CONSOLE TTY   
        CAL     WFWR
	CAL	WRITE	/PAUSE  WRITE IT ALSO ONTO THE LISTING DEVICE    
	CAL	WFWR 
	ISZ	PAUSW	/SET THE PAUSE SWITCH
	CAL	(6)	/DO A PAUSE REQUEST  
	DZM	PAUSW	/CLEAR THE PAUSE SWITCH
RDCDA	CAL	READCD	/READ A CARD 
	CAL	WFEV	/WAIT FOR EVENT VARIABLE 
	LAC	EV	/CHECK TO SEE THAT READ IS GOOD 
	SPA 
	JMP	BDRD	/NOT OK BAD READ    
	LAC	RN   
	JMP	RETRA	/RETRY THE REQUEST 
 
/$ERR CARD
/THIS IS IGNORED IF JOBFND IS 0 OR 1(NOT IN JOB, OR JOB RUNNING OK)
/BUT IS PROCESSED IF JOBFND=-1(ERROR TERMINATION)
/WHEN RECOGNIZED, IT SET JOBFND=1 AND ACTS AS A $MSG RECORD TO
/KEEP THE OPERATOR INFORMED
 
ERRIT	LAC	BD+3	/TEST SECOND HALF
	AND	(777400)
	SAD	ERR2
	SKP		/SKIP IF $ERR
	JMP	LGRTN	/ELSE
 
	LAC	JOBFND	/GET JOB STATUS FLAG(-1,0,1)
	SMA
	JMP	RDCDA	/IGNORE COMPLETELY
	CLA!IAC
	DAC	JOBFND	/SET TO INDICATE JOB RUNNING
	JMP	MSGITP	/PRINTOUT $ERR
/    
LOGIT	LAC	BD+3	/CHECK SECOND HALF OF LOG REQUEST  
	AND	(777400)  
	SAD	LOG2 
	SKP 
	JMP	LGRTN	/RETURN NOT LOG STATEMENT    
	CAL	WRITE	/PUT LOG ONTO LISTING DEVICE 
	CAL	WFWR 
	JMP	RDCDA
MSGIT	LAC	BD+3 
	AND	(777400)  
	SAD	MSG2 
	SKP 
	JMP	LGRTN
MSGITP	CAL	WRITE
	CAL	WFWR 
	CAL	WRITE2	/WRITE OUT LOG STATEMENT    
        CAL     WFWR
	JMP	RDCDA	/GO READ ANOTHER CARD AND TRY AGAIN    
/    
QUITA	LAC	BD+3	/CHECK SECOND WORD  
	AND	(777400)  
	SAD	QUIT2
	SKP 
	JMP	LGRTN	/NOT A QUIT CONTINUE    
	LAW	-1
	DAC	QUEOJ	/SIGNAL TO REQCMP THAT THIS IS THE END OF FILE
	LAC	2,X	/IS THE REQ. TSK TDV?
	SAD	TDVSTL    
I.MOD	JMP	NABMSG	/YES.  NO ABORT MSG.  NOT AN ERROR.   
			/CAUSE BATCH MODE TO END BY CAUSING TDV TO EXIT.    
	JMP	CNTLCD	/NO.  ERROR. 
/    
/    
/    
/	REQUEST COMPLETED -- SET REQUESTOR'S EVENT VARIABLE TO +1 
/	AND PICK NEXT REQUEST (IF ANY) FROM QUEUE. 
/    
SEV	PAL		/SAVE EVENT VARIABLE 
	LAC	(SKP)	/DON'T READ A NEW CARD  
	DAC	ABTSKP    
	JMP	.+3  
REQCMP	LAC	(2)		/EV IS +2
/    
	PAL		/SAVE EV IN LR
	LAC	RE	/SET UP FOR 17 BITS   
	TAD	XADJ 
	PAX 
	PLA 
	DAC	0,X	/SET EVENT VARIABLE  
	LAC	(401000) /DECLARE SIGNIFICANT EVENT    
	ISA 
/    
	LAC	(POOL)	/RETURN NODES TO THE POOL   
	DAC*	(R1)	/AND DO AN I/O COUNT DOWN    
	LAC	RN   
	DAC*	(R2)
	JMS*	(IOCD)   
	JMS*	(NADD)	/ADD A NODE TO POOL   
	LAC	QUEOJ	/TEST TO SEE IF END OF JOB
	TAD	FICLS	/OF FILE NOW CLOSED(IF IN HOLDING MODE)
	SZA		/NO
	JMP	GETJOB		/YES!!
ABTSK	XCT	ABTSKP	/TO READ OR NOT TO READ THAT IS THE QUESTION    
	JMP	WFTGR	/READ    
	JMP	NONDFA	/NO READ JUST WAIT FOR TRIGGER   
/    
/    
INCRCL	LAC	(60)	/SET INCORRECT RECORD LENGTH IN HEADER 
	XOR	BD   
	DAC	BD   
	LAC	TEMPA	/TRANSFER MAXIMUM WORDS 
	TCA 
	DAC	TEMP 
	JMP	STOR	/GO TRANSFER   
/    
STLRD	PXA		/SAVE XR 
	DAC	XRSV 
	LAC	BD+2	/LOOK FOR $ CARDS   
	AND	(774000)  
	SAD	(220000) /$?   
	SKP 
	JMP	STLFLS	/NO READ ANOTHER CARD  
	LAC	11,X	/PICK UP WORD COUNT 
	TCA		/MAKE IT NEGATIVE  
	DAC	TEMP 
	LAC	10,X	/PICK UP BUFFER ADDRESS  
	DAC	BUFSAV	/SAVE IT FOR FUTURE USE
	LAC	(FACCB+5)	/RESET POINTERS FOR FAC  
	DAC	FACCBX    
	LAC	(BD+2)    
	DAC	FACLBX    
SCNLP	JMS	FAC	/READ A CHARACTER    
	SAD	(040)	/IS IT A SPACE?    
	JMP	SPFND	/YES SAVE POSITION 
	SAD	(175)	/IS IT AN ALTMODE? 
	JMP	BDCMD	/YES BAD COMMAND  
	SAD	(015)	/CR?
	JMP	CRFND	/YES EXIT TEST
	DZM	MVCR	/OTHER FOUND CLEAR SPACE FOUND FLAG
	JMP	SCNLP	/READ ANOTHR  
CRFND	LAC	MVCR	/STORE CR?
	SNA 
        JMP     CRFNDB  /NO   
	LAC	FACSAV	/SAVE POINTER TO CHARACTER  
	AAC	-2   
	DAC	FACLBX    
	LAC	CRSAV	    
	PAX 
	XCT	.,X	/GO FIX CRRTN   
	JMP	CHR1 
	JMP	CHR2 
	JMP	CHR3 
	JMP	CHR4 
	JMP	CHR5 
CRFNDB  LAC     FACLBX   
        DAC     FACSAV   
CRFNDA	LAC	(BD)	/FIND BUFFER SIZE  
	TCA 
	TAD	FACSAV    
	CLL!RAR  
	SWHA
	DAC	TEMPA	/SAVE HEADER WORD PAIR COUNT 
	LAC	BD   
	AND	(777)	/AND SET THE NEW ONE IN THE BUFFER
	XOR	TEMPA
	DAC	BD   
	LAC	BD+2	/LOOK AT THE CARD AND FOR JOB CARD 
	SAD	JOB1 
	SKP		/FIRST HALF JOB CARD CHECK SECOND 
         JMP       NOTJB2              /NOT A JOB CARD  CONTINUE 
	LAC	BD+3	/SECOND HALF JOB CARD?   
	AND	(777400)  
	SAD	JOB2 
	JMP	GETDAT	/YES GO PRINT THE DATE 
NOTJB2	LAC	JOBFND	/HAS A JOB CARD BEEN SEEN?
	AAC	-1
	SPA		/SKIP IF JOB RUNNING,
			/DROP IF ERROR TERMINATION OR END OF JOB STATE
	JMP	STLFLS	/NO IT HASN'T
	LAC	BD+2	/NOT A JOB CARD, LOOK AT NEXT PART
	SAD	(222131) /$EOF?
	SKP		/MAYBE   
	JMP	NOTEOF	/NO !!  
	LAC	BD+3 
	AND	(777400)  
	SAD	(743000)/EOF?  
	JMP	STLFLS	/YES IGNORE IT    
NOTEOF	LAC	(NAMCNT*2) /END OF LIST 
	PAL 
	CLX		/CLEAR XR
FRBD	LAC	BD+2	/CHECK FIRST WORD    
	SAD	FILNM,X	/IS IT A COMMAND 
	JMP	FRAD	/FIRST WORD OK 
FRBDA	AXS	2	/ADD 2 TO XR AND CHECK FOR NEXT  
	JMP	FRBD 
BDCMD	CAL	WRITE	/PRINT OUT THE BAD CONTROL CARD
	JMS	ERRORP	/PRINT OUT "UNK $CARD ERR"
	BDCERR
	JMP	STLFLS	/FLUSH THE CARD
SPFND	LAC	MVCR	/SPACE FOUND CHECK IF MORE THAN 1  
	SZA 
	JMP	SCNLP	/YES TRY AGAIN
	LAC	CHRCNT	/SAVE COUNT  
	DAC	CRSAV
	LAC	FACLBX	/GET POINTER TO NEXT WORD PAIR   
	DAC	FACSAV    
	ISZ	MVCR	/SET SPACE FOUND FLAG    
	JMP	SCNLP	/TRY AGAIN    
CHR1	LAC	(064000)	/PICK UP CHARACTER    
	DAC*	FACLBX	/SET CR RTN 
	JMP	CRFNDA    
/    
CHR2	LAC*	FACLBX    
	AND	(774000) /SAVE 1 CHARACTER    
	XOR	(000320) /ADD IN CR 
	DAC*	FACLBX   
	JMP	CRFNDA	/RETURN 
/    
CHR3	LAC*	FACLBX    
	AND	(777760)  
	XOR	(1)	/ADD IN CR RTN  
	DAC*	FACLBX   
	ISZ	FACLBX	/GET SECOND WORD  
	LAC	(500000)  
	DAC*	FACLBX	/STORE IT   
	JMP	CRFNDA	/RETURN 
/    
CHR4	ISZ	FACLBX	/POINT TO WORD 2   
	LAC*	FACLBX   
	AND	(700000)  
	XOR	(6400)    
	DAC*	FACLBX   
	JMP	CRFNDA    
/    
CHR5	ISZ	FACLBX	/POINT TO WORD 2   
	LAC*	FACLBX   
	AND	(777400)  
	XOR	(32) 
	DAC*	FACLBX   
	JMP	CRFNDA    
/    
FRAD	LAC	BD+3	/CHECK SECOND HALF OF WORD
	AND	(777400)  
	SAD	FILNM+1,X 
	JMP	NAMOK	/NAME OK PROCEED   
	JMP	FRBDA	/NOT OK CHECK NEXT ONE IN LIST    
NAMOK    PXA                 /PRINT OUT CARD ONTO LSTDEV    
         SAD       (JOBCD)      /DONT PRINT OUT JOB CARDS 
         JMP       NAMOK2
	SAD	(ENDCD)	/NOR END CARDS, CLEAR JOBFOUND FLAG
	JMP	NAMOK1
         TAD       (EJPAG)     /CHECK FOR THOSE CARDS NEEDING PAGE EJECT
         SPA   
         CAL       WREJ  
         CAL       WRITE 
         CAL       WFWR  
	JMP	NAMOK2
NAMOK1	DZM	JOBFND	/MARK IT AS HAVING NOT SEEN A JOB
			/CARD
NAMOK2   LAC       BD+3      /REMOVE THE $ AND ADD A NULL   
	LMQ 
	LAC	BD+2 
	LLS	7	/SHIFT OUT $ 
	DAC	BD+2 
	LLS	3    
	CLL 
	ALS	7    
	LLS	10	/LAST CHARACTER  
	AND	(700376) /FORCE NULL
	DAC	BD+3	/STORE THE WORD
	LAC	BUFSAV	/FIND BUFFER POINTER   
	DAC*	(R3)	/FAKE VALADATE AND ADJUST    
	JMP	STOR	/RETURN CARD TO TDV 
/    
STLFLS	JMS	WAJOB	/WAIT TILL JOB PRINTOUT DONE IF IN PROGRESS
	CAL	READCD	/READ A CARD FOR FLUSHING BAD CONTROL CARD 
	CAL	WFEV	/WAIT FOR EVENT VARIABLE 
	LAC	EV	/EV LEGAL?  
	JMS	BDRD	/CHECK FOR CORRECT READ, SIGNAL QUEOJ IF NOT
	JMS	DELLF
	LAC	XRSV	/RESTORE XR    
	PAX 
	JMP	RDCD	/OK GO DECODE IT    
/    
RDEOFF	LAC	(1005)	/RETURN ENOD OF FILE TO USER FOR $EOF CARD
	DAC	BD   
	TCA 
	DAC	BD+1 
	JMP	RDEF	/GO MOVE IT TO USER'S BUFFER  
/    
CNTLCD	JMS	ERRORP
	READLR	/TRIED TO READ CONTROL CARD ERROR
NABMSG	LAC	RN	/FIND STL NODE ADDRESS    
	AAC	2    
	DAC	TEMPA
	LAC*	TEMPA	/STL NODE ADDRESS 
	DAC	TEMPA
	LAC*	(CURTSK)	/CURRENT ACTIVE TASK LIST NODE
	DAC	TEMP 
	LAC*	TEMP	/SEARCH FOR ENTRY  
SRCHLP	TAD	XADJ
	PAX 
	LAC	6,X	/STL  
	SAD	TEMPA	/FOUND?  
	JMP	FNDSTL	/YES ABORT TASK   
	LAC	0,X	/NO NOT FOUND YET    
	DAC	ATLADR
	SAD	(ATKL)    
	JMP	NOTATL	/NOT THE ATL 
	JMP	SRCHLP	/TRY AGAIN   
/
/ TASK FOUND IN THE ACTIVE TASK LIST. CHECK TASK STATUS.
/
FNDSTL	LAC	A.TS,X
	SPA
	JMP	ABLOAD		/TASK IS LOADING -- SET START ADDR TO 300
	SAD	(1)
	JMP	STAT1		/STATUS 1.
/
/ STATUS 3 (WHEN TASK NOT LOADING) OR STATUS 4, 5, OR 6. FORCE TASK TO EXIT.
/
	LAC	(4)		/SET TASK STATUS TO INDICATE "READY TO RUN".
	DAC	A.TS,X
ABLOAD	LAC	(300		/SET START ADDR TO 300
	DAC	A.RA,X
	JMP	ABOXIT
/
/ STATUS 1 -- TASK WAITING FOR PARTITION TO FREE UP.
/
STAT1	LAC	A.SN,X		/SAVE TASK'S STL NODE ADDRESS.
	DAC	STLADR
	LAC	ATLADR		/DELETE NODE FROM THE ATL.
	DAC*	(R1)
	JMS*	(NDEL)		/(R1, R2, R6, XR & AC ARE ALTERED).
	LAC	(POOL)		/ADD NODE TO THE EMPTY POOL.
	DAC*	(R1)
	LAC	ATLADR
	DAC*	(R2)
	JMS*	(NADD)		/(R2, R6, XR & AC ARE ALTERED).
	LAC	STLADR		/SET THE STL NODE ADDRESS IN THE XR.
	TAD	XADJ
	PAX
	LAC	S.DP,X		/CLEAR BIT 0 IN THE FLAGS WORD TO INDI-
	AND	(377777)	/CATE THAT THE TASK IS INACTIVE.
	DAC	S.DP,X
ABOXIT	LAC	3,X	/GET SECOND HALF OF THE TASK NAME
	SAD	(565656) /IS IT ... (IE. A SYSTEM PROGRAM)
	JMP	.+2
	JMP	ATLNTF
	LAC	2,X	/SEE IF IT IS TDV??
	SAD	(240426)
	JMP	ATLNTF	/YES!!!, DONT REQUEST IT AGAIN
	CAL	REQTDV
ATLNTF	LAC	(SKP)	/SET UP SO NO CARD IS READ  
	DAC	ABTSKP    
	JMP	REQCMP	/SET USER'S EVENT VARIABLE  
/    
NOTATL	JMS	ERRORP	/NOT IN ACTIVE TASK LIST
			/USUSLLY CAUSED WHEN A NON BATCH TASK TRIES
			/TO READ FROM BATCH. WASNT FOUND IN ATL 
			/BECAUSE BATCH ONLY LOOKS BELOW ITSELF(CURTSK)
	WRNTSK
	JMP	ATLNTF    
/    
GETDAT	CAL	WRSTR	/PRINT LINEFEED
	CAL	WRITE2	/PRINT JOB LINE
	CLA!IAC	/SET 1
	DAC	JOBFLG	/ALLOW CONCURRENT TYPOUT WITH JOB START PROCESSING   
	DAC	JOBFND	/SET SWITCH TO INDICATE THAT A JOB CARD HAS BEEN
	DZM	TLEMOD	/PUT TLE PROCESOR INTO OVERRUN STATE
	JMP	NOTJB2    
/    
MVCR	0    
FACSAV	0  
CHRCNT	0  
CRSAV	0   
DELLF	0   
	LAC	BD+2	/REMOVE LF IF FIRST CHARACTER 
	AND	(774000) /AND TDV READ   
	SAD	(050000)  
	SKP 
	JMP*	DELLF	/NOT LF 
        LAC     (BD+2  /REMOVE LF AND SHIFT REST OF CHARS   
        DAC     PTR   /INIT. PTR (POINTS TO 1ST WD. OF EACH PAIR)
        LAC     BD   /INIT. CNTR (-NO. OF WORD PAIRS IN BUFFER)  
        SWHA   
        AND     (177
        TCA    
        IAC          /DISREGARD HEADER WORDS 
        DAC     CNTR
DELLF1  LAC     PTR   /SET PTR1 AND PTR2
        IAC    
        DAC     PTR1
        IAC    
        DAC     PTR2
        LAC*    PTR1  /LOAD MQ WITH 2ND WD. OF THIS PAIR    
        LMQ    
        LAC*    PTR  /LOAD AC WITH 1ST WORD OF THIS PAIR    
        LLS     7  /SHIFT OUT FIRST CHAR. OF THIS WORD PAIR 
        DAC*    PTR  /STORE NEW 1ST WD  
        LACQ   
        AND     (777400  /REMOVE GARBAGE FROM 2ND WORD OF PAIR   
        DAC     TEMP1    
        LAC*    PTR2  /1ST CHAR. IN NEXT PAIR BECOMES LAST (5TH) CHAR 
        LMQ    
        CLA!CLL
        LLS     7   
        SAD     (15   /TEST FOR CR SHIFTING INTO 5TH CHAR POSITION    
        JMP     DELLF2   
        RCL    
        TAD     TEMP1    
        DAC*    PTR1  /STORE 2ND WORD   
        LAC     PTR2  /INCREMENT PTR    
        DAC     PTR 
        ISZ     CNTR  /TEST FOR END OF BUFFER
        JMP     DELLF1  /NOT END OF BUFFER   
        JMP*    DELLF   / RETURN   
DELLF2  RCL              /CR WAS SHIFTED
        TAD     TEMP1    
        DAC*    PTR1  /STORE THE WORD   
        ISZ     CNTR  /TEST TO SEE IS CR SHIFTED IN WAS PART OF THIS  
        SKP         /BUFFER OR GARBAGE LEFT OVER FROM BEFORE
        JMP*    DELLF  /CR WAS GARBAGE  
        LAC     BD  
        TAD     (777000  /SUBTRACT A WORD PAIR FORM HEADER  
        DAC     BD  
        JMP*    DELLF  /RETURN
CNTR    NOP    
PTR     NOP    
PTR1    NOP    
PTR2    NOP    
TEMP1   NOP    
/    
/	FAC -- SUBROUTINE TO FETCH A CHARACTER FROM 5/7 ASCII LINE BUFFER 'FACLB'.    
/	CHARACTERS ARE NOT FETCHED BEYOND TERMINAL CHARACTERS
/    
FAC	0
	LAC*	FACCBX	/FETCH NEXT UNPACKED CHARACTER FROM 'FACCB'    
	SMA		/WAS CHARACTER BUFFER (FACCB) EMPTY?   
	JMP	FAC2	/NO -- TEST FOR TERMINAL CHARACTER 
	DZM	CHRCNT    
	LAC	(FACCB-1)	/YES -- REFIL 'FACCB'    
	DAC	FACCBX    
	LAC*	FACLBX	/(FIRST HALF OF WORD PAIR) 
	ISZ	FACLBX    
	LMQ 
	CLA!CLL  
	JMS	FACUPS	/(FIRST CHAR)
	JMS	FACUPS	/(SECOND CHARACTER
	JMS	FACUPS	/(FIRST FOUR BITS OF THIRD CHARACTER) 
	LAC*	FACLBX	/(SECOND HALF OF WORD PAIR)
	ISZ	FACLBX    
	LRS	17	/(LAST THREE BITS OF THIRD CHAR)
	XOR*	FACCBX   
	DAC*	FACCBX   
	CLA 
	JMS	FACUPS	/(FORTH CHAR)
	JMS	FACUPS	/(FIFTH CHAR)
	LAC	(FACCB)	/RESET CHAR BUF INDEX 
	DAC	FACCBX    
	LAC*	FACCBX	/FETCH FIRST CHAR FROM BUFFER   
FAC2	ISZ	CHRCNT
	SAD	(015)	/IF TERMINAL CHARACTER, (CR OR AM)
	JMP*	FAC	/RETURN WITH CHAR IN AC BUT DO NOT 
	SAD	(175)	/AUGMENT CHAR BUF INDEX (REPEATED CHAR)
	JMP*	FAC	/OF FAC WILL RETURN THE TERMINAL CHARACTER)  
/    
	ISZ	FACCBX	/NON-TERMINAL CHARACTER -- AUGMENT CHARACTER    
	JMP*	FAC	/BUFFER INDEX AND RETURN WITH CHAR IN AC
/    
FACUPS	0		/UNPACKING SUBROUTINE -- AC & LINK MUST BE   
	LLS	7	/CLEARED, NEXT CHAR MUST BE IN HIGH ORDER  
	ISZ	FACCBX	/MQ, 'FACCBX' MUST POINT TO WORD PRECEEDING
	DAC*	FACCBX	/CHAR TO BE STORED.   
	CLA		/CHAR IS SHIFTED INTO AC (LOW ORDER BITS    
	JMP*	FACUPS	/OF THIRD CHAR ARE ZERO BECAUSE LINK IS   
		/ZERO), STORED, 'FACCBX' IS LEFT POINTING TO    
		/CHAR, AND AC IS CLEARED (LINK IS ALSO LEFT CLEARED  
FACLBX	BD+2	/LINE BUFFER INDEX
FACCBX	FACCB+5	/CHARACTER BUFFER INDEX  
FACCB	.BLOCK	5	/CHARACTER BUFFER (5 IMAGE ALPHA CHARS) 
	-1		/END OF 'FACCB' INDICATOR
/    
/    
/    
WFEV2	20  
	EV2 
EV2	0
JOBFLG	0  
WAJOB	0	/SUBROUTINE WHICH WAITS ON EV2 IF AFTER JOB CARD    
	LAC	JOBFLG    
	SZA 
        CAL        WFWR      /WAIT ON EVENT VARIABLE   
         DZM       JOBFLG
	JMP*	WAJOB	/RETURN TO CALLER 
/    
/	THIS ROUTINE ALLOWS THE PRINTOUT OF JOB START TO OVERLAP  
/	THE $JOB PROCESSORS OPERATION    
/	BUT EVERYTING WAITS WHEN THE NEXT CARD IS READ UNTIL 
/	THE TTY PRINTOUT IS DONE    
/    
	    
/    
REQTDV	1	/REQUEST TDV    
	0	/EVENT VARIABLE ADDRESS    
	.SIXBT	'TDV...'    
	0	/PRIORITY   
/    
/    
WFEV	20   
	EV  
/    
EV	0 
/    
READCD	2600    
	EV  
	1	/THIS NUMBER IS ALTERED BY GETJOB TO THE INPUT LUN NUMBER
	2   
	BD  
	45  
/    
WFTCPB	20	/WAIT FOR TRIGGER   
	TG  
/    
TG	0	/TRIGGER  
/    
/    
WRITE	2700	/WRITE CONTROL CARD
	EVR 
	LSTDEV   
	2   
	BD  
WRITE2	2700    
	EVR 
	OPRDEV   
	2   
	BD  
WREJ     2700  
         0
         LSTDEV
         2
         PAGEJ 
PAGEJ    002002
         0
         060320
         000000              /THIS IS A PAGE EJECT ON A LINEPRINTER   
/    
WFWR	20	/WAIT FOR WRITE  
	EVR 
/    
EVR	0
/    
	.EJECT   
REQEND	1  
	0   
	.SIXBT	/END.../    
	0   
SAVXR	0   
WRSTR	2700
	0  	/NO EV FOR THIS LINEFEED, ITS USED FOR DELAYING
			/JOB LINE PRINTOUT
	OPRDEV   
	3   	/IMAGE MODE
	WRSTRT   
WRSTRT	WRSTRE-WRSTRT/2*1000+3 
	0   
	12
	15
WRSTRE=.  
/    
XADJ	0	/XR ADJUSTMENT    
XRSV	0    
TEMP	0    
TEMPA	0   
BUFSAV	0	/BUFFER ADDRESS 
TDVSAV	0	/SAVED ^T TTY NO
PDVRQ	0	/PDVL Q
PDVEV	0	/TRIGGER ADDRESS 
RN	0	/REQUESTOR'S NODE   
RE	0	/REQUESTOR'S EVENT VARIABLE   
TDVSTL	0	/TDV STL NODE   
ABTSKP	0  
ATLADR	0
STLADR	0
/    
BDRD	0	/SUBROUTINE TO CHECK BATCH DEVICE READ
	SPA	/SKIP IF EVENT VARIABLE IS OK(IN AC ON ENTRY)
	JMP	EOJREC	/NO!,THISIS THE END CAUS' OF ERROR
	LAC	BD	/GET HEADER WORD
	AND	(7)
	SAD	(5)	/TEST FOR END OF FILE
	SKP		/YES, EOF
	JMP*	BDRD	/NO, GOOD RECORD
EOJREC	LAW	-1
	DAC	QUEOJ	/SET THE ERROR TERMINATE FLAG
	JMP*	BDRD	/RETURN TO CALLER
/    
/    
ERM30	LAW	-30	/PROTECT VIOLATION   
	JMP	SEV  
/    
ERM7	LAW	-7	/ILLEGAL DATA MODE
	JMP	SEV  
/    
	.EJECT
QUIT1	.ASCII	'$QUI' 
QUIT2=.-1 
/    
PAU1	.ASCII	'$PAU'  
PAU2=.-1  
LOG1	.ASCII	'$LOG'  
LOG2=.-1  
MSG1	.ASCII	'$MSG'  
MSG2=.-1  
FILNM    .ASCII    '$SLI'
         .ASCII    '$TKB'
         .ASCII    '$DIR'
         .ASCII    '$REQ'
         .ASCII    '$DTD'
         .ASCII    '$FOR'
	.ASCII	'$F4F'
	.ASCII	'$SPN'
	.ASCII	'$XQT'
ERR1	.ASCII	'$ERR'
ERR2=.-1
EJPAG=FILNM+1-.		/ALL CARDS PRECEDING THIS GET A PAGE EJECT
	.ASCII	'$MAC' 
	.ASCII	'$LIS' 
	.ASCII	'$FOU' 
	.ASCII	'$FIN' 
	.ASCII	'$DEC' 
	.ASCII	'$BTK' 
	.ASCII	'$DEL' 
	.ASCII	'$REN' 
	.ASCII	'$REM' 
	.ASCII	'$INS' 
	.ASCII	'$PUP'
	.ASCII	'$CON'
	.ASCII	'$MNT'
	.ASCII	'$DSM'
	.ASCII	'$QUE'
JOBCD=.-FILNM
	.ASCII	'$JOB'
JOB1=.-2
JOB2=.-1
ENDCD=.-FILNM
	.ASCII	'$END' 
/    
	.END
	.ASCII	'$XQT'
ERR1	.ASCII	'$ERR'
ERR2=.-1
EJPAG=FILNM+1-.		/ALL CARDS PRECEDING THIS GET A PAGE EJECT
	.ASCII	'$MAC' 
	.ASCII	'$LIS' 
	.ASCII	'$FOU' 
	.ASCII	'$FIN' 
	.ASCII	'$DEC' 
	.ASCII	'$BTK' 
	.ASCII	'$DEL' 
	.ASCII	'$REN' 
	.ASCII	'$REM' 
	.ASCII	'$INS' 
	.ASCII	'$PUP'
	.ASCII	'$CON'
	.ASCII	'$MNT'
	.ASCII	'$DSM'
	.ASCII	'$QUE'
JOBCD=.-FILNM
	.ASCII	'$JOB'
JOB1=.-2
JOB2=.-1
ENDCD=.-FILNM
	.ASCII	'$END' 
/    
	.END
	.ASCII	'$XQT'
ERR1	.ASCII	'$ERR'
ERR2=.-1
EJPAG=FILNM+1-.		/ALL CARDS PRECEDING THIS GET A PAGE EJECT
	.ASCII	'$MAC' 
	.ASCII	'$LIS' 
	.ASCII	'$FOU' 
	.ASCII	'$FIN' 
	.ASCII	'$DEC' 
	.ASCII	'$BTK' 
	.ASCII	'$DEL' 
	.ASCII	'$REN' 
	.ASCII	'$REM' 
	.ASCII	'$INS' 
	.ASCII	'$PUP'
	.ASCII	'$CON'
	.ASCII	'$MNT'
	.ASCII	'$DSM'
	.ASCII	'$QUE'
JOBCD=.-FILNM
	.ASCII	'$JOB'
JOB1=.-2
JOB2=.-1
ENDCD=.-FILNM
	.ASCII	'$END' 
/    
	.END
