	.TITLE	AB.OPR TASK ABORT PROGRAM FOR RSX/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
/
/	ABORT FUNCTION TASK FOR  BATCH
/	EDIT #1  1/30/74  G. COLE
/	EDIT #2	12/31/75	M. HEBENSTREIT
/
/
/
/ AB.OPR IS CALLED WHEN IT IS NECESSARY TO ABORT
/ OVERRUNING USER TASK WHICH HAS BEEN INITIATED BY RSX/BATCH.
/
/ AB.OPR CAN BE CALLED BY OPR> OR BY TLE... WHEN THE JOB TIME LIMIT HAS 
/ EXCEEDED AND THE TLACT SWITCH IS SET TO ABORT (1)
/
/ AB.OPR WILL ABORT THE TASK WHICH IS RUNNING AT ONE LESS THAN THE PRIORITY
/ OF TDC AND IN THE SAME PARTITION AS TDC. THIS SHOULD DIFFERENTIATE IT FROM
/OTHER TASKS WHICH USE THE PARTITION.
/
/
/
/GENERAL PROGRAM LOGIC:
/
/ SEARCH ATL FOR  "TDC"
/ EXTRACT PRIORITY AND PARTITION
/ PRI=PRI-1
/
/
/ SEARCH ATL FOR A TASK AT PRI AND PARTITION OF TDC
/
/SET ADRS TO RESTART TO 300
/SET STATUS TO 5 IF STATUS IS NOT 1 OR 2
/
/
	.EJECT
/ DEFIN VARIABLES:
R1=101
R2=102
BCV=147	/BATCH CONTROL VECTOR
CURTSK=135
ATL=244
SNAM=123
POOL=240
NADD=107
NDEL=112
A.TS=7
A.RA=10
A.SN=6
S.DP=4
/
 
 
START	LAC	(.)	/COMPUTE ADDRESS CORRECTOR FOR INDEXING
	AND	(70000)
	TCA
	DAC	XRFIX	/SAVE
 
 
/ SET THE JOB STOP FLAG TO RSX/BATCH IF IT IS RUNNING
 
	LAC*	(BCV)	/GET ADDRESS OF BATCH COM VECTR
	SNA
	JMP	STOPD
 
	AAC	16	/OFFSET TO JOBFND FLAG
	DAC	TEMP
	LAW	-1
	DAC*	TEMP
 
STOPD	LAC	(TDCNAM)
	DAC*	(R2)
	LAC	(ATL)
	DAC*	(R1)	/SETUP TO SEARCH ATL FOR TDC TASK
	JMS*	(SNAM)
	JMP	QUIT	/RETURN IF NOT FOUND
 
 
	TAD	XRFIX	/CORRECT NODE ADDRESS
	PAX
 
	LAC	4,X	/GET TASK PRIORITY
	AAC	-1
	DAC	TSKPRI	/SAVE PRI-1
	LAC	5,X
	DAC	TSKPAR	/SAVE PARTITION BLOCK ADDRESS
 
	LAC*	(CURTSK)	/SETUP TO SEARCH ATL
	DAC	TEMP
	LAC*	TEMP	/GET FIRST NODE AFTER US
NXT	TAD	XRFIX
	PAX		/SET INDEX
	LAC	TSKPRI
	SAD	4,X	/COMPARE WITH THIS NODE
	SKP
	JMP	NXTSK	/IF DIFFERENT
	LAC	TSKPAR
	SAD	5,X	/COMPARE PARTITION NAME
	JMP	FOUND
 
NXTSK	LAC	0,X	/GET NEXT TASK NODE
	DAC	ATLADR
	SAD	(ATL)	/IS IT THE END
	SKP		/YES
	JMP	NXT	/NO
 
QUIT	CAL	(10)	/YES, EXIT
/
/ TASK FOUND IN THE ACTIVE TASK LIST. CHECK TASK STATUS.
/
FOUND	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	QUIT
/
/ 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	XRFIX
	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
	JMP	QUIT	/EXIT NOW
 
XRFIX	0
ATLADR	0
STLADR	0
TSKPRI	0	/HOLDS PRI OF TDC-1
TSKPAR	0	/HOLDS PAR BLOCK ADRS OF TDC AND USER TASK TO BE FOUND
TEMP	0
TDCNAM	.SIXBT	/TDC@@@/	/NAME OF TASK TO BE FOUND
 
	.END	START
