	.TITLE OPR  --  OPERATOR COMMUNICATION WITH BATCH
/ 
/ 
/                   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
/
/	OPR FUNCTION TASK
/	EDIT #1  1/30/74  G. COLE
/
/
/
/	OPR FUNCTION
/
/	THIS PROGRAM IS DESIGNED TO BE USED FROM A TERMINAL
/	VIA A CONTROL/X INITIATION AND IS EXPECTED TO BE
/	NAMED OPR.XX WHERE XX IS THE TERMINAL NUMBER IF
/	IT IS TO BE SUBDISPATCHED OR TTY.XX IF IT IS TO BE
/	CALLED BY A CONTROL/X DIRECTLY
/
/	WHEN IT IS CALLED IT PROMPTS THE USER
/	WITH THE PRINTOUT
/	
/	OPR>
/
/	THE USERS INPUT IS ONE LINE CONSISTING OF A COMMAND FOLLOW
/	IF NECESSARY BY AN ARGUMENT.
/	THE COMMAND IS IDENTIFIED BY THE FIRST 2 CHARACTERS
/	AND IS DELIMITED BY A SPACE(OR STRING OF SPACES)
/
/	WHEN THE COMMAND HAS BEEN PROCESSED, PREHAPS WITH ERROR
/	MESSAGES TO THE USER, OPR WILL EXIT.
/
	.EJECT
/DEFINE PRINT MACRO:
	.DEFIN	PRINT,ZLUN,ZA,ZB,ZC,ZD,ZE,ZF
	CAL	.+3
	CAL	.+10
ZTMP2=.
	HLT
	2700
	.+4
	ZLUN
	2
	.+4
	0
	20
	.-2
ZTMP=.
	0
	0
	.ASCII	"ZA ZB ZC ZD ZE ZF"<015>
ZTMP1=.
	.LOC	ZTMP
	ZTMP1-ZTMP/2*1000+2
	.LOC	ZTMP2
	JMP	ZTMP1
	.LOC	ZTMP1
	.ENDM
/
/DEFINE PARAMETERS
	.IFUND	TTYLUN
	.END -- TTYLUN MUST BE DEFINED
	.ENDC
BCV=147	/LOCATION OF VECTOR TO BATCH CONTROL VECTOR
NADD=107	/ROUTINE TO ADD NODES TO LIST
POOL=240	/POOL OF FREE NODES
NDEL=112	/REMOVE NODE FROM LIST
R1=101
R2=102	/REENTRANT REGISTERS
MJOB1=323	/LOCATION OF HEADER FOR BATCH JOB QUEUE
TTLUN=TTYLUN
	.EJECT
START	NOP	/ENTRY POINT
/
/
	CAL	TSKNAM	/GET TASK NAME, USED MUCH LATER
	CAL	WRIOPR	/WRINT OUT "OPR>"
	CAL	WAIT
	CAL	READOP	/GET USERS RESPONSE
	CAL	WAIT
	LAC	EV
	SMA
	JMP	OK
	CAL	(10)		/EXIT IF INPUT ERROR
	.EJECT
OK	JMS*	SET57
	LINBF
			/GET THE INPUT LINE READY TO BE SCANNED
	JMS	GETC	/GET FIRST CHAR
	JMP	SRPRO	/PRINT STATUS REPORT
	CLL!RTL; RTL; RTL; RAL	/SHIFT 7
	DAC	CMD
	JMS	GETC
	JMP	FMTERR	/FORMAT ERROR
	TAD	CMD		/ADD IN FIRST CHAR
	CLL!RTL; RTL		/SHIFT 4(HALF OF NEXT CHAR
	AAC	4	/ADD IN THE 
				/TOP HALD OF A SPACE
	DAC	CMD
 
SCANOF	JMS	GETC		/GOTO FIRST BLANK OR EOL
	JMP	DECODE
	SAD	(40)	/BLANK?
	JMP	DECODE
	JMP	SCANOF		/DELETES ALL BUT FIRST TWO CHAR IN CMD
	.EJECT
DECODE	LAC	CMD		/GET USER COMMAND(TWO CHAR)
	SAD	EXCMD
	JMP	EXPRO		/EXIT COMMAND
	SAD	PRCMD
	JMP	PRPRO		/PROCEED COMMAND
	SAD	GOCMD
	JMP	PRPRO		/GO AND PROCEED ARE THE SAME
	SAD	WACMD
	JMP	WAPRO		/WAIT COMMAND
	SAD	ONCMD
	JMP	ONPRO		/ON STATION COMMAND
	SAD	OFCMD
	JMP	OFPRO		/OFF STATION COMMAND
	SAD	QUCMD
	JMP	QUPRO		/QUEUE JOB COMMAND
	SAD	SCCMD
	JMP	SCPRO		/SCHEDULE COMMAND
	SAD	KICMD
	JMP	KIPRO		/KILL COMMAND
	SAD	FOCMD
	JMP	FOPRO		/FORCE COMMAND
	SAD	JOCMD
	JMP	JOPRO		/JOBS COMMAND
	SAD	CACMD
	JMP	CAPRO		/CANCEL COMMAND
	SAD	STCMD
	JMP	STPRO		/STOP COMMAND
	SAD	TDCMD
	JMP	TDPRO		/RECOVER SEQUENCE COMMAND
	SAD	HOCMD	
	JMP	HOPRO		/HOLD JOB COMMAND
	SAD	RECMD
	JMP	REPRO		/RELEASE JOB COMMAND
	SAD	MOCMD
	JMP	MOPRO		/MORE TIME ALLOWED COMAND
	SAD	TLCMD		/TLE ACTION COMMAND
	JMP	TLPRO
	SAD	ABCMD
	JMP	ABPRO		/ABORT TASK AND STOP JOB COMMAND
	PRINT	TTLUN,UNKNOWN,COMMAND
	JMP	DONE
	.EJECT
/
/CONSTANTS FOR COMMAND DECODER
/ONLY ONE WORD IS USED, HENCE THE OVERWRITE
/
EXCMD	.ASCII	/EX /
	.LOC	.-1
 
PRCMD	.ASCII	/PR /
	.LOC	.-1
GOCMD	.ASCII	/GO /
	.LOC	.-1
 
WACMD	.ASCII	/WA /
	.LOC	.-1
 
ONCMD	.ASCII	/ON /
	.LOC	.-1
 
OFCMD	.ASCII	/OF /
	.LOC	.-1
 
QUCMD	.ASCII	/QU /
	.LOC	.-1
 
SCCMD	.ASCII	/SC /
	.LOC	.-1
 
KICMD	.ASCII	/KI /
	.LOC	.-1
 
FOCMD	.ASCII	/FO /
	.LOC	.-1
 
JOCMD	.ASCII	/JO  /
	.LOC	.-1
 
CACMD	.ASCII	/CA /
	.LOC	.-1
  
STCMD	.ASCII	/ST /
	.LOC	.-1
 
TDCMD	.ASCII	/TD /
	.LOC	.-1
HOCMD	.ASCII	/HO /
	.LOC	.-1
RECMD	.ASCII	/RE /
	.LOC	.-1
MOCMD	.ASCII	/MO /
	.LOC	.-1
TLCMD	.ASCII	/TL /
	.LOC	.-1
ABCMD	.ASCII	/AB /
	.LOC	.-1
/
/	END OF COMMAND LIST
TSKNAM	25
	0
TSKN1	0
TSKN2	0	/THIS WORD GET SEC HALF OF THIS TASKS NAME
/
WRIOPR	2700
	EV
	TTLUN
	3
	.+1
	004003	/8 WORD, IMAGE ASCII 6 CHAR OUTPUT
	0
	12	/LF
	15	/CR
	117	/O
	120	/P
	122	/R
	76	/>
 
/
READOP	2600
	EV
	TTLUN
	2
	LINBF
	60
LINBF	.BLOCK 60
WAIT	20
	EV
EV	0
CMD	0	/HOLDS COMMAND NAME
/
/FETCH A CHAR SUBROUTINE, USES EXTERNAL SUBROUTINE FAC57
	.GLOBL FAC57
	.GLOBL	SET57
GETC	0
	JMS*	FAC57
	SAD	(15)	/TEST FOR CR
	JMP*	GETC	/RTN TO CALL + 1 ON EOL
	SAD	(175)
	JMP*	GETC
	ISZ	GETC
	JMP*	GETC	/RTN WITH CHAR IN AC
/
/THE FAC57 SUBROUTINE EXTRACTS CHARACTERS FROM A 5/7 ASCII
/BUFFER WHICH HAS BE DESCRIBED TO IT BY SET57.
/ONCE END OF LINE IS REACHE, IT IS RETURNED INDEFINITELY
/
	.EJECT
DONE	CAL	(10)	/RETURN TO SYSTEM!!
 
FMTERR	PRINT	TTLUN,FORMAT,ERROR
	JMP	DONE
ILLERR	PRINT	TTLUN,ILLEGAL,ARGUMENT
	JMP	DONE
/
/
/COMMAND PROCESSING SECTION
/
/
EXPRO	LAC*	(BCV)	/GET TO BCV
	SNA
	JMP	BNRERR	/BATCH NOT RUNNING
	AAC	14	/LOCATION OF EXJOB FLAG
	DAC	TEMP
	LAW	-1
	DAC*	TEMP
	JMP	DONE	/SET EXJOB TO -1 WILL CAUSE BATCH TO EXIT
			/AT THE END OF THE NEXT JOB
TEMP	0	/GENERAL TEMPORARY CELL
BNRERR	PRINT	TTLUN,BATCH,NOT,RUNNING
	JMP	DONE
/
/
/	PROCEED COMMAND
PRPRO	LAC*	(BCV)
	SNA
	JMP	BNRERR	/BATCH NOT RUNNING, EXIT
	AAC	14
	DAC	TEMP	/EXJOB FLAG
	CAL	RESBAT	/ATTEMP TO RESUME BATCH
	LAC	EV
	SMA		/SKIP IF BATCH IS NOT PAUSED
	JMP	DONE	/ESLE EXIT IF IT IS PAUSED
	DZM*	TEMP	/SET 0 TO GOTO NEXT JOB
	JMP	DONE
RESBAT	07
	EV
	.SIXBT	/BAT.../
	0		/RESUME AFTER CURRENT PAUSE
/
/
/	MORE COMMAND
/		MORE IS USED TO ALLOW A JOB MORE TIME
/		BY CANCELING THE REQUEST FOR TLE... WHICH
/		JOB... HAS MADE. THIS NORMALLY WILL BE
/		USED WHEN A JOB HAS EXCEEDED ITS TIME ESTIMATE
/		BUT BEFORE IT EXCEEDS ITS TIME LIMIT.
/
 
MOPRO	LAC*	(BCV)	/IS BATCH RUNNING?
	SNA
	JMP	BNRERR	/NO
 
	CAL	CANTLE	/CANCEL REQUEST FOR TLE...
	JMP	DONE	/OUTCOME OF THE REQUEST IS NOT VERY NECESSARY
			/TO KNOW.
 
CANTLE	4	/CPB TO CANCEL TLE...
	0	/NO EVENT VARIABLE
	.SIXBT	/TLE.../
 
	.EJECT
/
/
/	WAIT COMMAND
WAPRO	LAC*	(BCV)
	SNA
	JMP	BNRERR	/BATCH NOT RUNNING , EXIT
	AAC	14
	DAC	TEMP	/EXJOB FLAG
	CLA!IAC
	DAC*	TEMP	/SET EXJOB TO 1 TO HOLD BETWEEN JOBS
	JMP	DONE
/
/
/	ON STATION COMMAND
ONPRO	LAC*	(BCV)
	SNA
	JMP	BNRERR
	AAC	3
	DAC	TEMP	/OPON FLAG IN BATCH
	CLA!IAC
	DAC*	TEMP	/SET OT SAY OPERATOR READY
	JMP	DONE
/
/
/	OFF STATION COMMAND
OFPRO	LAC*	(BCV)
	SNA
	JMP	BNRERR
	AAC	3
	DAC	TEMP	/OPON FLAG
	DZM*	TEMP	/SET TO SAY OPERATOR NOT HERE
	JMP	DONE
/
/
/	KILL FILE COMMAND -- KILLS TO END OF FILE, NOT JOB
KIPRO	LAC*	(BCV)
	SNA
	JMP	BNRERR
	AAC	12	/QUEOJ FLAG IN BATCH
	DAC	TEMP
	LAW	-1
	DAC*	TEMP	/SET TO SIMULATE END OF FILE
	LAC	TEMP
	AAC	4
	DAC	TEMP	/POINT TO JOBFND WORD
	DZM*	TEMP	/SET TO ZERO(NEEDED TO MAKE SCPRO PRINTOUT CORRECTLY)
/
/			KILL TERMINATES BY GENERATING A STOP COMMAND
/
/	STOP COMMAND -- GOES TO NEXT JOB
STPRO	LAC*	(BCV)
	SNA
	JMP	BNRERR
	AAC	16	/GOTO JOBEND FLAG
	DAC	TEMP
	LAW	-1	/SET JOBFND TO -1
	DAC*	TEMP	/TO INDICATE THAT IT IS IN ERROR MODE
			/AND WILL NO LONGER BE PROCESSED
			/UNLESS A $ERR SECTION IS ENCOUNTERED.
	JMP	DONE
	.EJECT
/
/
/
/
/	TDV COMMAND -- RECOVERS STREAM BY REQUESTING TDV
/			USE IF SYSTEM PROGRAM CALS OUT
/			AND BATCH PROCESSING STOPS.
TDPRO	CAL	REQTDV
	JMP	DONE
 
REQTDV	1
	0
	.SIXBT	/TDV.../
	0
/
/
/T	TLE COMMAND
/		USED TO SET THE ACTION TO BE TAKEN WHEN TIME
/		LIMIT EXCEEDED OCCURS.
/
/	OPR>TLE XXXX
/		   XXXX=ABORT,STOP,REPORT
/
/	ONLY THE FIRST CHAR INS USED IN THE SCAN
/
/	FORMAT ERROR IF NO ARG GIVEN
/	ILLERR IF NOT A,S,OR R
/
 
TLPRO	JMS	GETC
	JMP	FMTERR	/IF NO NON-BLANK ON LINE
	SAD	(40)
	JMP	TLPRO	/SCAN OFF BLANKS
	SAD	(101)	/TEST FOR A
	JMP	TLABOR
	SAD	(122)	/TEST FOR R
	JMP	TLREPO
	SAD	(123)	/TEST FOR S
	JMP	TLSTOP
	JMP	ILLERR	/ERROR "ILLEGAL ARGUMENT"
TLABOR	LAC	(1)
	JMP	TLACT
TLSTOP	LAC	(3)
	JMP	TLACT
TLREPO	LAC	(4)
	JMP	TLACT
 
TLACT	LMQ
	LAC*	(BCV)	/IS BATCH RUNNING
	SNA
	JMP	BNRERR	/NO!!
	AAC	22	/OFFSET TO TLEACT
	DAC	TEMP
	LACQ		/GET VALUE TO BE STORED
	DAC*	TEMP	/SET IT
	JMP	DONE
	.EJECT
/
/
/	SCHEDULE COMMAND
/		THIS COMMAND INVOKES THE SCHOPR
/		TASK TO SET A NEW SCHEDULE INTO THE SYSTEM
/		IT IS OTHERWISE IDENTICAL TO THE QUEUE FUNCTION
/
/	OPR>SCH
/
/
 
SCPRO	CAL	REQSCH
	JMP	QUCHK
REQSCH	1
	EV
	.SIXBT	/SC.OPR/
	0
	.EJECT
/
/
/	ABORT COMMAND
/		THIS COMMAND CAUSES OPR TO REQUEST THE
/
/		AB.OPR TASK. THAT TASK ABORTS A USER TASK IF ONE
/		IS RUNNING AT THE PRIORITY OF TDC -1
/		TDC MUST ALSO BE IN THE ACTIVE TASK LIST.
/		AB.OPR ALSO STOPS THE JOB SETTING JOBFND TO -1
/
/		THIS COMMAND USES COMMON CODE IN QUPRO
 
ABPRO	CAL	REQABT
	JMP	QUCHK
REQABT	1
	EV
	.SIXBT	/AB.OPR/
	0
	.EJECT
/
/	QUEUE COMMAND, REQUESTS A VERSION OF QUEUE FOR THIS
/		TERMINAL,PRINTS "TASK NOT AVAILABLE"
/		IF QUE.XX IS NOT RUNNABLE
QUPRO	CAL	REQQUE	/RESUEST QU.OPR
QUCHK	LAC	EV
	SMA
	JMP	DONE	/IF REQUESTED OK
	PRINT	TTLUN,TASK,NOT,AVAILABLE
	JMP	DONE
 
REQQUE	1
	EV
	.SIXBT	/QU.OPR/
	0
	.EJECT
/
/JOBS COMMAND: PRINTOUT OF THE WAITING JOB LIST
/
/THE FORMAT OF THE PRINTOUT IS:
/  XXXXX  NNNNN(LLL) [OPR] [SEQ] [SPN]
/
/    XXXXX IS THE JOB "NUMBER" FOR CANCEL OR FORCE
/    NNNNNN IS THE JOB NAME
/    LLL IS THE LUN
/    OPR,SEQ SPN ARE OPTIONAL AND INDICATE THOSE CHARACTERISTICS.
/
/
JOPRO	CAL	DISBAT	/DISABLE BAT... UNTIL DONE
			/DONE TO PREVENT BATCH COMMING UP DURING 
			/PRINTOUT.,DOESNT AFFECT BATCH IF BATCH
			/IS RUNNING
	LAC*	(BCV)	/GET TO BCV
	DZM	TEMP	/TEMP IS A SWITCH ALSO
	SNA
	JMP	JOSCN
	AAC	14	/WORD 14--EXJOB
	DAC	TEMP
	LAC*	TEMP
	DAC	SAVEXJ	/SAVE CURRENT VALUE
	CLA!IAC
	DAC*	TEMP	/SET TO 1 -- WAITING
/THIS PREVENTS BATCH FORM PLAYING WITH THIS LIST UNTIL
/THE PRINTOUT IS DONE...A USEFUL CONSTRAINT!!!
JOSCN	LAC*	(MJOB1)
	SAD	(MJOB1)	/TEST FOR EMPTY LIST
	JMP	JONONE	/TRUE!!
JOLOOP	LAC*	(MJOB1)	/GET ADDRESS OF NEXT NODE
	DAC	JOBND	/SAVE IT
	JMS	PRINTJ	/TYPE OUT DATA
	LAC*	JOBND
	SAD	(MJOB1)/TEST FOR END OF LIST
	JMP	JODONE
	JMP	JOLOOP+1	/GOTO NEXT ITEM
JONONE	PRINT	TTLUN,NONE,WAITING
JODONE	CAL	ENABAT	/REENABLE BAT...
	LAC	TEMP	/CHECK SWITCH
	SNA
	JMP	DONE
	LAC	SAVEXJ	/RESET EXJOB IF INIT SET
	DAC*	TEMP
	JMP	DONE	/COMMAND PROCESSING FINISHED
DISBAT	21
	0
	.SIXBT	/BAT.../
ENABAT	22
	0
	.SIXBT	/BAT.../
	.EJECT
/PRINTJ THE SUBROUTINE THAT PRINTS OUT THE JOB DATA!!
/ALL THIS IS JUST EDITING OUT THE OUTPUT LINE
/LINE FORMAT IS IN IMAGE MODE FOR SIMPLICITY AND SPEED
PRINTJ	0
	LAC	JOBND	/ADDRESS OF JOB NODE
	DAC*	(10)	/INTO AUTOINDEX
	AND*	10	/SKIP BACK LINK
	LAC*	10
	DAC	JOBFL1	/GET FILE NAME
	LAC*	10
	DAC	JOBFL2
	AND*	10	/SKIP PRIORITY
	LAC*	10	/GET LUNS
	DAC	JOLUN
	LAC*	10
	DAC	JINFO
	LAC*	10
	DAC	SP1
	AND*	10
	LAC*	10
	DAC	JOTIME	/TIME WHEN QUEUED
	JMP	PUTNUM
JOBFL1	0
JOBFL2	0
JOTIME	0
JOLUN	0
JINFO	0
SP1	0
JOBND	0
SAVEXJ	0
	.EJECT
PUTNUM	LAC	(OUTBF+1)
	DAC*	(10)	/AUTO 10 IS POINTER TO OUTPUT LINE
			/USED EVERYWHERE..
/
/DEFINE LOCAL MACRO  PUTC
	.DEFIN	PUTC,ZA
	LAC	(ZA)
	DAC*	10
	.ENDM
//
//
	PUTC	40
 
	LAC	JOTIME	/TIME IN SSM WHEN QUEUED
	LMQ
	JMS	GDIG	/MOVE 3 BITS TO AC, ADD 60 AND DAC* 10
	JMS	GDIG
	JMS	GDIG
	JMS	GDIG
	JMS	GDIG
	JMS	GDIG	/TIME IS NOW IN BUFFER
 
	PUTC	40
	PUTC	40
	PUTC	40	/MIDDLE SPACES
 
	LAC	JOBFL1
	LMQ		/FIRST HALF FILE NAME
	JMS	GCHR	/
	JMS	GCHR	/LLS 6, CONVT TO ASCII,DAC* 10
	JMS	GCHR
	LAC	JOBFL2
	LMQ
	JMS	GCHR
	JMS	GCHR
	JMS	GCHR
	.EJECT
	PUTC	50	/'('
/
/CONVERT LUN TO DECIMAL AND PRINT
/
	LAC	JOLUN
	SWHA
	AND	(777)	/GET LUN NUMBER
	LMQ
	CLA!CLL
	DIV
	144		/DIVIDE BY 100
	DAC	REMDR
	LACQ
	TAD	(60)
	DAC*	10	/PUT OUT HIGH ORDER DIGIT
	LAC	REMDR
	LMQ
	CLA!CLL
	DIV
	12		/DIVIDE BY 10
	DAC	REMDR
	LACQ
	TAD	(60)
	DAC*	10	/PUT OUT MIDDLE DIGIT
	LAC	REMDR
	TAD	(60)
	DAC*	10	/PUT OUT LOW DIGIT
 
	PUTC	51	/')'
	.EJECT
	PUTC	40
	PUTC	40	/PUT OUT SPACES BEFORE OPTIONS
/
/OUTPUT TIME,CLASS,AND MEMORY SPECIFICATIONS
/FORMAT IS T=XXX C=X M=XX  ARGUMENT NOT PRINTED
/			IF VALUE IS ZERO.
 
JOPT	LAC	JINFO	/GET TIME ESTIMATE
	AND	(177)
	SNA
	JMP	JOPC	/NOT NON-ZERO SO DONT PRINT IT
	PUTC	124	/T
	PUTC	75	/=
	LAC	JINFO	/GET TL AGAIN
	AND	(1777)
	JMS	CONVTD	/CONVERT TO DECIMAL AND SUPRESS LEADING DIGITS
	PUTC	40	/SPACE
 
JOPC	LAC	SP1	/EXTRACT JOB CLASS FORM TOP 3 BITS OF SP1
	CLL!RTL; RTL
	AND	(7)	/ONE DIGIT
	LMQ		/SAVE CLASS IN MQ
	SNA
	JMP	JOPM	/CLASS IS ZERO, TRY MEMORY SIZE
	PUTC	103
	PUTC	75	/OUTPUT C=
	LACQ
	JMS	CONVTD	/CONVERT DIGIT TO DECIMAL AND OUTPUT
	PUTC	40	/SPACE
 
JOPM	LAC	SP1	/EXTRACT MEMORY SIZE
	AND	(177)
	LMQ		/SAVE IN MQ
	SNA
	JMP	JOP0	/NO NEED FOR M PRINTOUT
	PUTC	115
	PUTC	75	/M=
	LACQ
	IAC	/ADD ONE TO GET CORRECT SIZE
	JMS	CONVTD
	PUTC	40
 
 
JOP0	LAC	JINFO
	AND	(200000)
	SNA
	JMP	JOP1
 
	PUTC	117	/PUT OUT "OPR"
	PUTC	120
	PUTC	122
	PUTC	40
 
JOP1	LAC	JINFO
	AND	(40000)
	SNA
	JMP	JOP2
 
	PUTC	123	/PUT OUT "SEQ"
	PUTC	105
	PUTC	121
	PUTC	40
 
JOP2	LAC	JINFO
	AND	(20000)
	SNA
	JMP	JOP3
 
	PUTC	123	/PUT OUT "SPN"
	PUTC	120
	PUTC	116 
	PUTC	40
JOP3	LAC	JINFO	/TEST FOR HOLDING BIT
	AND	(10000)
	SNA
	JMP	JOP4
	PUTC	110
	PUTC	117
	PUTC	114
	PUTC	104
	PUTC	40
JOP4	LAC	JINFO	/TEST FOR CCL FORMAT JOB
	AND	(4000)
	SNA
	JMP	JOP5
	PUTC	103
	PUTC	103
	PUTC	114
	PUTC	40
JOP5	PUTC	15	/PUT OUT LF CHAR
	PUTC	12	/PUT OUT CR
	PUTC	0	/PUTOUT ANOTHER  CHAR SO ROUNDDOWN WORKS
	LAC	(OUTBF)
	TCA
	TAD*	(10)	/COMPUTE WORD TO PRINT
	IAC
	RAR!CLL		/DIVIDE BY 2
	SWHA
	AAC	3
	DAC	OUTBF	/HEADER WORD
 
	CAL	WRIJOB
	CAL	WAIT
	JMP*	PRINTJ 
WRIJOB	2700
	EV
	TTLUN
	3
	OUTBF
OUTBF	120003
	0
	.BLOCK	116
REMDR	0
GDIG	0	/EXTRACT DIGIT FROM MQ
	CLA!CLL
	LLS	3
	TAD	(60)
	DAC*	10
	JMP*	GDIG
 
GCHR	0
	CLA!CLL		/EXTRACT SIXTBT CHAR AND OUT ASCII CHAR
	LLS	6
	SNA
	AAC	40	/MAKE NULLS TO SPACES
	AAC	-40
	SPA
	AAC	100	/IF CHAR 0-37
	AAC	40	/ALWAYS
	DAC*	10
	JMP*	GCHR
	.EJECT
/
/
/	FORCE COMMAND
/		THIS IS USED TO SET THE "OPERATOR PRIORITY"
/		INDICATOR FOR THE JOB, FORCING BATCH TO RUN IT
/		NEXT(IF OTHER CONDITIONS PERMIT)
/
/	FORCE IS IMPLEMENTED USING MOST OF THE CODE OF CANCEL
/		AND A FLAG TO DIFFETENTIATE FORM SAME.
/
/	FORM OF COMMAND IS:
/
/	OPR>FORCE  XXXXXX
/
/			XXXXXX IS THE JOB NUMBER LISTED BY THE
/					JOBS COMMAND.
/
/
FOPRO	CLA!IAC
	DAC	FOFLG	/SET FLAG
	JMP	CAPRO	/GOTO CANCLE PROCESSING
 
FOJOB	LAC	CANODE	/CANCEL TRANSFERS HERE WHEN NODE FOUND
	AAC	6	/GOTO JINFO WORD
	DAC	CATEMP
	LAC*	CATEMP
	AND	(677777)	/CLEAR FORCE INDICATOR
	TAD	(100000)	/SET FORCE INDICATOR
	DAC*	CATEMP
 
	JMP	DONE		/FORCE COMPLETE
	.EJECT
/
/
/	HOLD COMMAND
/		THIS IS USED TO KEEP A JOB FROM RUNNING
/		EVEN IF OTHER CONDITIONS ARE FAVORABLE
/		IT DOES THIS BY SETTING THE HOLD BIT IN THE NODE
/
/	HOLD IS IMPLEMENTED USING COMMON CODE FROM FORCE
/		AND CANCEL COMMAND PROCESSING.
/
/	THE FORMAT OF THE HOLD COMMAND IS:
/
/	OPR>HOLD XXXXXX
/
/			HERE XXXXXX IS THE JOB IDENT FROM THE JOBS
/				PRINTOUT
 
HOPRO	CLA!IAC
	DAC	HOFLG
	DAC	FOFLG
	JMP	CAPRO	/SET HOLD AND FORCE FLAGS AND GOTO COMMON CODE
 
HOJOB	LAC	CANODE	/RETURN HERE FOR HOLD OR REALESE COMMANDS
	AAC	6	/COMPUTE ADDRESS OF JINFO WORD
	DAC	CATEMP
	LAC	REFLG	/TEST FOR A RELEASE COMMAND
	SZA		/SKIP IF NOT
	JMP	REJOB	/JMP IF SO
	LAC*	CATEMP
	AND	(667777)	/AND OUT HOLD BIT
				/AND CLEAR FORCE BIT
	TAD	(10000)		/SET HOLD BIT
	DAC*	CATEMP	/RESET WORD
	JMP	DONE
	.EJECT
/
/
/	RELEASE COMMAND
/		THIS COMMAND IS USED TO CONTERACT THE AFFECT OF
/		A HOLD COMMAND FOR A JOB.
/
/	RELAEASE COMMANDS USE COMMON CODE WITH HOLD,FORCE
/		AND CANCEL SO THAT THERE IS REALLY VERY LITTLE
/		LEFT!!
/
/	THE FORMAT OF A RELEASE COMMAND IS:
/
/	OPR>RELEASE XXXXXX
/
/		HERE XXXXXX IS THE JOB IDENT FROM THE JOBS PRINTOUT
/
 
REPRO	CLA!IAC
	DAC	REFLG
	JMP	HOPRO+1
 
REJOB	LAC*	CATEMP	/ALL SET UP TO CLEAR BIT
	AND	(767777)
	DAC*	CATEMP	/RESET
	JMP	DONE
HOFLG	0
REFLG	0
	.EJECT
/
/
/	CANCEL COMMAND
/
/	THE CANCEL COMMAND ALLOWS THE OPR TO ELIMINATE ONE
/		OR ALL OF THE QUEUED JOBS FROM THE JOB LIST
/
/	THE FORMAT IS 
/
/	OPR>CANCEL XXXXX
/
/	OR
/
/	OPR>CANCEL ALL
/
/	XXXXXX IS THE JOB NUMBER PRINTED BY THE JOBS COMMAND.
/
/
/	CANCEL USES COMMON CODE WITH FORCE SINCE THEY BOTH
/	SCAN THE LINE IN MUCH THE SAME WAY AND BOTH NEED TO
/	LOOK UP A JOB NODE. PLEASE NOTE THAT AS LONG AS OPR RUNS
/	AT A HIGHER PRIORITY THAN BAT...,THERE ARE NO
/	POSSIBLE RACE CONDITIONS IN THE QUEUE MANIPULATION.
/
/
	.EJECT
CAPRO	DZM	CAALL	/CLEAR FLAG WHICH INDICATES A CANCEL ALL CMD
	JMS	GETC
	JMP	FMTERR	/MUST GET TO AN ARGUMENT
	SAD	(40)
	JMP	CAPRO	/SCAN THROUGH SPACES
 
	SAD	(101)	/LOOK FOR LAETTER A
	SKP
	JMP	CANUM	/IF NOT AND A, ASSUME A NUMBER
	LAC	FOFLG	/IS THIS A FORCE COMMAND
	SZA
	JMP	ILLERR	/YES!!
	JMS	GETC	/GET NEXT
	JMP	ILLERR	/MUST BE EXACTLY "ALL"
	SAD	(114)
	SKP
	JMP	ILLERR
 
	JMS	GETC
	JMP	ILLERR	/TEST FOR SECOND L
	SAD	(114)
	SKP
	JMP	ILLERR
			/SUCESS, THIS IS A CANCEL ALL COMMAND
	ISZ	CAALL	/SET FLAG
	JMP	CAXCT	/PROCESS COMMAND
	.EJECT
CANUM	DZM	CAVAL	/CLEAR ACCUMULATED VALUE
	AAC	-60	/SUB "0" FORM VALUE IN AC
	DAC	CATEMP	/SAVE (MIGHT BE GOOD)
	SPA		/TEST FOR GE 60
	JMP	ILLERR	/NO, QUIT
	AAC	-10
	SMA		/TEST FOR LT 70
	JMP	ILLERR	/MUST BE AN OCTAL DIGIT 0,1,2,3,4,5,6,7
	LAC	CAVAL
	RTL!CLL; RAL	/MULTIPLY AC BY 8
	TAD	CATEMP	/ADD SAVED DIGIT
	DAC	CAVAL
	JMS	GETC
	JMP	CAXCT	/END OF LINE, PROCESS DATA
	JMP	CANUM+1	/CONTINUE FOR NEXT DIGIT
 /
/LOCAL VARIABLES TO CANCEL
CATEMP	0
FOFLG	0	/SET TO INDICATE FORCE FUNCTION
CAVAL	0	/HOLDS JOB NUMBER
CAALL	0	/SET NONZERO TO SAY CANCEL ALL
CANODE	0	/HOLDS NODE ADDRESS
CADELF	3500	/CPB TO DELETE JOB FILE IF TEMPORARY
	EV
CALUN	0	/FILLED FROM JOB NODE
CAFIL1	0
CAFIL2	0
	.SIXBT	/JOB/
 
CAEND	LAC	CAALL	/COME WHEN END OF LIST REACHED
	SZA	/IF SINGLE CANCEL SKIP
	JMP	DONE
	PRINT	TTLUN,JOB,NOT,QUEUED	/ERROR IF NOT CANCELED
	JMP	DONE
					/OR FORCED
	.EJECT
CAXCT	LAC*	(MJOB1)	/LOOK FOR JOB NODE
	SAD	(MJOB1)
	JMP	CAEND	/END OF LIST REACHED
	DAC	CANODE	/NODE ADDRESS
	AAC	11
	DAC	CATEMP	/ADDRESS OF TIME QUEUED(JOB NUMBER)
	LAC*	CATEMP
	SAD	CAVAL	/COMPARE WITH SELECTED JOB
	JMP	CAACT	/YES.. CANCEL THIS ONE
	LAC	CAALL
	SZA
	JMP	CAREM	/IF CANCEL ALL SET, CANCEL THIS ONE
	LAC*	CANODE	/GET ADDRESS OF NEXT NODE
	JMP	CAXCT+1	/LOOP TO NEXT
 
 
CAACT	LAC	HOFLG	/IS IT REALLY AHOLD OR RELEASE COMMAND
	SZA	/NO  IF SKIP
	JMP	HOJOB	/YES, EITHER HOLD OR RELEASE
	LAC	FOFLG	/IS IS A FORCE COMMAND
	SZA
	JMP	FOJOB	/YES!!!!!!>>GO BACK TO THERE
 
	.EJECT
CAREM	LAC	CANODE	/EXTARCT JOB DATA FROM NODE
	DAC*	(10)
	AND*	10	/SKIP BACK POINTER
	LAC*	10
	DAC	CAFIL1
	LAC*	10
	DAC	CAFIL2	/GET FILE NAME
	AND*	10	/SKIP PRIORITY
	LAC*	10
	DAC	CALUN	/GET LUN
	SWHA
	AND	(777)
	DAC	CALUN
	LAC*	10
	DAC	CAJINF	/JINFO WORD
 
	LAC	CANODE
	DAC*	(R1)	/USE RESIDENT ROUTINE TO REMODE THE NODE FROM
	JMS*	(NDEL)	/THE JOB QUEUE
 
	LAC	(POOL)
	DAC*	(R1)
	LAC	CANODE
	DAC*	(R2)	/PUT TTHE NODE INTO THE POOL
	JMS*	(NADD)
 
	LAC	CAJINF	/TEST FOR DELETE AFTER RUN FLAG
	SMA
	JMP	CANEXT
 
	CAL	CADELF	/DELETE FIL
	CAL	WAIT
CANEXT	LAC	CAALL
	SNA
	JMP	DONE	/IF A SPECFIC FILE WAS WANTED
	JMP	CAXCT	/IF MORE MUST BE DONE!!
 
CAJINF	0
/
/
/	STATUS REPORT 
/	INITIATED BY A EMPTY LINE TO OPR
/
/	PRINTS OUT THE STATUS OF THE BATCH SYSTEM
/
/	OUTPUT FORMAT IS A CODE FOLLOWD BY THE NUMBER OF
/	JOBS QUEUED
/
/	CODES ARE:
/	EXIT
/	R/E
/	IDLE
/	R/R
/	WAIT
/	R/W
/
/
/	JOBS QUEUED COUNT IS IN DECIMAL WITH LEADING ZEROS
/	SUPRESSED.
/
/	OPR>
/	IDLE  NONE QUEUED
/
/	OPR>
/	WAIT  24 QUEUED
/
/
	.EJECT
SRPRO	LAC*	(BCV)
	SNA
	JMP	BNRERR	/IF BATCH INACTIVE
	AAC	14
	DAC	TEMP	/GOTO EXJOB
	LAC*	TEMP
	DAC	SRNXT	/NEXT BATCH STATE
	LAC	TEMP
	AAC	2
	DAC	TEMP
	LAC*	TEMP
	SPA		/CONVERT NEG TO PLUS
	TCA		/ERROR STATE IS A RUNNING STATE
	DAC	SRNOW	/CURRENT STATE 0=IDLE,1=RUN
	DZM	SRCNT
/
/	COUNT THE NODES IN THE BATCH JOB QUEUE
/
	LAC*	(MJOB1)
SRLOOP	SAD	(MJOB1)	/TEST FOR END
	JMP	SRDON
	ISZ	SRCNT	/COUNT
	DAC	SRTMP
	LAC*	SRTMP
	JMP	SRLOOP	/CYCLE TILL END
SRDON	LAC	(OUTBF+1)	/SETUP PRINT BUFFER
	DAC*	(10)	/USES SAME TECHNIQUE AS JOBS ROUTINE
	PUTC	40
	.EJECT
	ISZ	TEMP	/POINT TO PAUSE FLAG
	LAC*	TEMP
	SNA	/SKIP 	IF PAUSED
	JMP	SRPRM	/ELSE PREPARE MESSAGE
	PUTC	120
	PUTC	101
	PUTC	125
	PUTC	123
	PUTC	105
	JMP	SRNUM	/PUT OUT "PAUSE"
SRPRM	LAC	SRNXT	/GET CODE FOR NEXT STATE(-1,0,1)
	AAC	1	/MAKE 0,1,2
	RAL!CLL		/MAKE 0,2,4
	TAD	SRNOW	/ADD 1 IF RUNNING,0 IF NOT
	DAC	SRMSG	/SAVE
 
	SAD	(0)
	JMP	SR.EXI
	SAD	(1)
	JMP	SR.RE
	SAD	(2)
	JMP	SR.IDL
	SAD	(3)
	JMP	SR.RR
	SAD	(4)
	JMP	SR.WAI
	SAD	(5)
	JMP	SR.RW
	PRINT	TTLUN,BATCH,STATUS,ERROR
	JMP	DONE
	.EJECT
SR.EXI	PUTC	105
	PUTC	130
	PUTC	111
	PUTC	124
	JMP	SRNUM
SR.RE	PUTC	122
	PUTC	57
	PUTC	105
	JMP	SRNUM
SR.IDL	PUTC	111
	PUTC	104
	PUTC	114
	PUTC	105
	JMP	SRNUM
SR.RR	PUTC	122
	PUTC	57
	PUTC	122
	JMP	SRNUM
SR.WAI	PUTC	127
	PUTC	101
	PUTC	111
	PUTC	124
	JMP	SRNUM
SR.RW	PUTC	122
	PUTC	57
	PUTC	127
	JMP	SRNUM
	.EJECT
SRNUM	PUTC	40
	PUTC	40
/
/CONVERT COUNT TO DECIMAL AND OUTPUT SUPRESSING LEADING ZEROS
/
	LAC	SRCNT
	SNA	/TEST FOR 0
	JMP	SRNDON	/PRINT OUT "NONE QUEUED"
	JMS	CONVTD	/ELSE OUTPUT THE NUMBER QUEUED
	JMP	SRNQ	/PRINT OUT "QUEUED"
/
/
/CONVTD SUBROUTINE, CONVERTS NUMBER TO DECIMAL AND SUPRESSES
/	LEADING ZEROS. DIGITS ARE DEPOSITED THROUGH AUTO 10.
/
CONVTD	0
	LMQ
	CLA!CLL
	DAC	DFLAG	/SET ZERO
	DIV
	144	/DIVIDE BY 100 DECIMAL
	DAC	REMDR
	LACQ
	SNA
	JMP	SRN2
	DAC	DFLAG	/SET NONZERO IF A LEADING DIG WAS NONZERO
	TAD	(60)
	DAC*	10	/FIRST CHAR OUT
SRN2	LAC	REMDR
	LMQ
	CLA!CLL
	DIV
	12		/DIVIDE BY 10
	DAC	REMDR
	LAC	DFLAG	/HAS A DIG BEEN PRINTED?
	SZA		/SKIP IF NOT
	JMP	SRNP2	/PRINT THIS DIGIT IN ANY CASE IF IT HAS
	LACQ
	SNA
	JMP	SRN3	/LEADING ZERO STILL
SRNP2	LACQ	/GET DIGIT
	TAD	(60)
	DAC*	10
SRN3	LAC	REMDR
	TAD	(60)
	DAC*	10
	JMP*	CONVTD	/RETURN TO CALLER
/
/
DFLAG	0	/TEMPORARY
	.EJECT
SRNDON	PUTC	116
	PUTC	117	/PUT OUT "NONE" IF ALL ZERO
	PUTC	116
	PUTC	105
SRNQ	PUTC	40	/SPACE
	PUTC	121
	PUTC	125
	PUTC	105
	PUTC	125
	PUTC	105
	PUTC	104
	.EJECT
SRPRT	PUTC	12
	PUTC	15	/SAME SEQUENCE AS IN THE JOP3 SECTION
	PUTC	15
	LAC	(OUTBF)
	TCA
	TAD*	(10)
	IAC
	RAR!CLL
	SWHA
	AAC	3
	DAC	OUTBF
	CAL	WRIJOB
	CAL	WAIT
	JMP	DONE	/PRIT OUT STATUS REPORT AND QUIT!!
SRNOW	0
SRNXT	0
SRTMP	0
SRMSG	0
SRCNT	0
	.END	START
