Google
 

Trailing-Edge - PDP-10 Archives - AP-D483B-SB_1978 - quench.mac
There are 7 other files named quench.mac in the archive. Click here to see a list.
TITLE	QUENCH  --  Queue Entry and Change Program - Version 2
SUBTTL	P.CONKLIN/DAL/PFC/LSS	29 Mar 77


;Copyright (C) 1975,1976,1977,
;	Digital Equipment Corporation, Maynard MA.


	SEARCH	MACTEN,SCNMAC
		%%MACT==%%MACT
		%%SCNM==%%SCNM

	SEARCH	QSRMAC
	SEARCH	UUOSYM
	IFN FTJSYS,<SEARCH MONSYM>

	.REQUE	REL:SCAN		;SYSTEM COMMAND SCANNER
		%%%SCN==:7
	.REQUE	REL:WILD		;COMMON FILE-SYSTEM MANIPULATOR
		%%%WLD==:7
	.REQUE	REL:HELPER		;SYSTEM HELP TEXT TYPER

;ASSEMBLY AND LOADING INSTRUCTIONS
;		.COMP QUENCH
;		.LOAD QUENCH
;		.SSAVE QUENCH


;VERSION INFORMATION
	QUHVER==2			;MAJOR VERSION
	QUHMIN==0			;MINOR VERSION
	QUHEDT==72			;EDIT NUMBER
	QUHWHO==0			;WHO LAST PATCHED

	%%QUH==<BYTE (3) QUHWHO (9) QUHVER (6) QUHMIN (18) QUHEDT>

	LOC	137
	EXP	%%QUH




	SALL				;SUPPRESS MACRO EXPANSIONS
SUBTTL	PARAMETERS AND DEFAULTS


;ASSEMBLY PARAMETERS

ND LN$PDL,60		;LENGTH OF PUSH-DOWN LIST
ND LN$ENT,11		;LENGTH OF A LOOKUP/ENTER BLOCK
ND PURESW,1		;1=REENTRANT VERSION

ND PUNCDP,0		;-1=NO PUNCH COMMAND
			;0=PUNCH COMMAND TO PTP
			;1=PUNCH COMMAND TO CDP



;NOW GET TO THE CORRECT SEGMENT
	IFE	PURESW,<RELOC>
	IFN	PURESW,<TWOSEG
			RELOC 400000>
;DEFAULTS


	RADIX	^D10
DM AFT,  10080,   0,  10	;AFTER CURRENT TIME IN MINUTES
DM CDP, 100000, 000,2000	;CARD PUNCH LIMIT IN CARDS
DM COP,     63,   1,   0	;NUMBER OF COPIES OF OUTPUT
DM COR,^O777777,25600,40960	;CORE LIMIT FOR JOB
DM DED,  10080,   0,  60	;DEADLINE FROM CURRENT TIME IN MINUTES
DM DPN,  65535,   0,   0	;INITIAL DEPENDENCY COUNT
DM LIM, 100000,  00,   0	;OUTPUT LIMIT
DM LPT, 100000,  00,2000	;LINE PRINT LIMIT IN PAGES
DM NHD,      1,   1,   1	;FILE HEADERS ON OUTPUT
DM PLT, 100000,  00,  60	;PLOT LIMIT IN MINUTES		[1201]
DM PRI,     62,  10,  20	;EXTERNAL PRIORITY
DM PTP, 100000, 000, 100	;PT PUNCH LIMIT IN FEET
DM RST,      1,   0,   1	;RESTART PARAMETER
DM SEQ, 100000,   0,   0	;JOB'S SEQUENCE NUMBER
DM STR, 100000,   1,   1	;STARTING POINT IN FILE
DM TIM,  .INFIN, 300,3600	;TIME LIMIT FOR JOB IN SECONDS
DM UNI,      2,   1,   2	;DEGREE OF FILE NAME UNIQUENESS


ND AD.LFD,DISPPRESERVE	;LOG FILE DISPOSITION
ND AD.OPN,.QORCR	;STANDARD OPERATION IS /CREATE
	RADIX	8
;THE QUEUES MACRO DEFINES ALL PARAMETERS WHICH NEED TO BE
;	EXPANDED INTO TABLES FOR THE VARIOUS QUEUES.
;
;EACH LINE IN THE QUEUES MACRO IS OF THE FORM:
;
;	QQ	A,B,C,D,E,F,G,H
;
;WHERE:
;	A	IS THE QUEUE NAME
;	B	IS THE DEFAULT INPUT EXTENSION
;;	C	INDEQ TO LIMITS FOR KJOB QUEUEING (-1 FOR NONE)
;	D	/PAPER KEYWORD LIST NAME
;	E	NAME OF ROUTINE TO PRINT LIMIT OF QUEUE
;	F	QUEUE LIMIT TEQT (SINGULAR)
;	G	QUEUE LIMIT TEQT (PLURAL)
;	H	MONITOR COMMAND FOR THE QUEUE

DEFINE QUEUES,<
	QQ	INP,CTL,-1,,LTIME,<Runtime>,<Runtime>,<SUBMIT>
	QQ	LPT,LPT,0,PRIN,LDEC,<Page>,<Pages>,<PRINT>
	QQ	CDP,CDP,1,PUNC,LDEC,<Card>,<Cards>,<CPUNCH>
	QQ	PTP,PTP,2,TAPE,LDEC,<Foot>,<Feet>,<TPUNCH>
	QQ	PLT,PLT,3,PLOT,LTIMEM,<Minute>,<Minutes>,<PLOT>
>  ;END DEFINE QUEUES


;NOW INSURE THAT INP QUEUE IS FIRST AND DEFINE QUEUE TYPE SYMBOLS
DEFINE	QQ(A,B,C,D,E,F,G,H),<
	IFDIF	<A>,<INP>,<PRINTX  ?FIRST QUEUE MUST BE INP>
	..TMP==0
	QTP'A==..TMP
	DEFINE	QQ(Z,Y,X,W,V,U,T,S),<
		..TMP==..TMP+1
		QTP'Z==..TMP
	>  ;END REDEFINITION OF QQ
>  ;END DEFINE QQ


IF1,<	QUEUES
>
SUBTTL	Revision History

;1	MAKE THIS QUENCH VERSION 1 FROM QUEUE VERSION 6
;2	PUT IN TOPS20 CODE
;3	CODE CLEANUP
;4	PUT IN NEW /OUTPUT STUFF
;5	ALWAYS FORCE JACCT OFF ON TOPS10

;50	MAKE THIS QUENCH VERSION 2
;	CALL QMANGR WIL QUEUE FORMAT VERSION 2 (Q.OPR<QO.VER>)
;51	ALLOW /TAG TO BE FULL 6 CHARACTERS LONG
;52	REMOVE SOME UNUSED ROUTINES
;53	CHANGE ALL CHECKS ON F.STRT AND I.STRT TO NOT USE SKIPL
;	AND SKIPGE SINCE WITH 6 CHARACTER NAMES THE WRONG THING HAPPENS.
;54	DO NOT DEFAULT THE /PRIO FIELD.
;55	REMOVE /PAPER SWITCH, ADD /PRESERVE AS SYNONYM FOR /DI:PRES
;	REMOVE /DI:RENAME, AND CHANGE LISTING FORMAT ON -20 TO PUT
;	USER NAME LAST.
;56	ON -20 IF LOOKUP ON THE FILE SUCCEEDS, SET BIT 15 IN Q.FMOD
;	AND PASS THE FILESPEC BLOCK AS A STRING TO QMANGR.
;57	ADD /USER SWITCH ON -20, PASS Q.PPN AS 0,,ADR WHERE ADR HAS A STRING.
;60	CONDITIONAL OUT LOTS OF CODE ON -20.  REARRANGE QUEUE LISTING FORMAT
;	ON THE -10.
;61	IN QUEUE LISTING, ONLY PRINT THE "CORE" COLUMN IF INPCOR IS NOT 0.
;62	TO GET TIME OF DAY DO APPROPRIATE UUO OR JSYS RATHER THAN CALLING
;	.GTNOW.
;63	CHANGE TEXT FOR INP QUEUE TOTALS TO JUST "RUNTIME".  FIX -20
;	STRUCTURE CHECKING CODE IN LIST ROUTINE.
;64	MORE OF EDIT 63 AND RANDOM CLEANUP.
;65	REMOVE SEARCH JOBDAT.

;;FIRST FIELD-TEST RELEASE OF GALAXY RELEASE 2, JAN. 1977

;66	MAKE CHECK FOR OFF-LINE STRUCTURE (-10) IN THE LISTER THE
;	SAME AS THE ONE IN QUASAR.
;67	MAKE DEFAULT INPUT DEVICE ON -20 ALWAYS "DSK".  MAKE THE
;	LOOKUP OF THE BATCH LOG FILE ALWAYS SPECIFY THE USER'S PATH.
;70	A FEW MORE LOG FILE FIXES.
;71	FIX ERROR MACROS AND CHANGE "ONE" OF THE "QUHPSI" ERRORS TO
;	"QUHPII".  FIX A PROBLEM IN EDIT 70.  MAKE /TIME SWITCH ALLOW
;	ONLY THREE FIELDS AND GIVE AN ERROR IF MORE A SPECIFIED.
;72	FIX A NUMBER OF MINOR PROBLEMS (QARS 32 AND 33).
SUBTTL	STANDARD MNEMONICS--REGISTERS, BITS, UUOS

;AC NAMES

F=0		;FLAGS (LH=PERMANENT, RH=TEMPORARY)
T1=1		;TEMPORARIES
T2=2
T3=3
T4=4

P1=5		;PRESERVED BY ONE AND ALL
P2=6		; ..

N=7		;NUMBER/NAME ...  USED BY SCAN
C=10		;CHARACTER FROM COMMAND STRING (READ ONLY AC)

I=11		;POINTS TO INPUT FILE SPEC
J=12		;POINTS TO CURRENT FILE IN QUEUE REQUEST
Q=13		;POINTS TO THE QUEUE REQUEST AREA

M=14		;LISTING MESSAGE POINTER
P=17		;PUSH-DOWN POINTER

;I/O CHANNELS

DC==1		;LOOKUP/RENAME DATA FILES
LC==2		;LISTINGS


..==0		;FLAG FOR FIELDS TO BE FILLED IN LATER
;PERMANENT FLAGS (LH)

L.LOGI==(1B17)	;THIS JOB IS LOGGED IN
L.NSBJ==(1B8)	;NOT LOGGED IN TOP LEVEL			[1177]

;TEMPORARY FLAGS (RH)

R.LTAB==1B35	;TAB NEEDED NEXT ON LISTING FILE
R.OUTL==1B30	;LISTING DEVICE NEEDS OUTPUT EACH LINE
R.NSEC==1B28	;SUPPRESS SECONDS LISTING
R.ANUL==1B27	;ALLOW DEVICE NUL:
;X.MOD LAYOUT DEFINITIONS

X.REMV==1B0	;/REMOVE
X.LOG==1B1	;THIS FILE IS THE JOB LOG FILE
X.NEW==1B2	;/NEW
X.NOHD==1B5	;/HEADER
X.STG==1B15	;STRING		;LOCAL USE ONLY
X.UNP==1B16	;/UNPRESERVED		;LOCAL USE ONLY
X.OKBN==1B17	;/OKBINARY		;LOCAL USE ONLY

X.SPAC==7B20	;/SPACING
X.PAPR==7B23	;/PAPER
X.FILE==7B26	;/FILE
X.DISP==7B29	;/DISPOSE
X.COP==77B35	;/COPIES


;QUEUE OPERATIONS
	.QORCR==1		;CREATE
	.QORDF==2		;/CREATE/DEFER (GALAXY ONLY)
	.QORZD==3		;/KILL/DEFER (GALAXY ONLY)
	.QORLS==4		;LIST
	.QORMD==5		;MODIFY
	.QORKL==6		;KILL
;MACROS

;SWSEG		SWITCHES SEGMENTS IF PURESW ON (ALSO FLUSHES LITS)

DEFINE	SWSEG<
IFN PURESW,<
		XLIST
		LIT
		LIST
		RELOC>>


;DEFINE RELOCATABLE 0 FOR HIGH AND LOW SEGS

..STRH==.
	SWSEG
..STRL==.
	SWSEG


;GCORE N	GET N MORE WORDS AT .JBFF

DEFINE	GCORE (A),<
	MOVEI	T1,A
	XLIST
	PUSHJ	P,GCORE.
	LIST
>
SUBTTL	Message Macros

DEFINE N$FATE(A,B,C,%A),<
	SKIPA
	XLIST
	JRST	%A
	PJSP	T1,NFMSG'B
	SIXBIT	\   A\
	ASCIZ	\C\
%A:
	IF1,<IFDEF N$$'A,<PRINTX  ?MULITPLE USE OF ERROR CODE A>>
	N$$'A==0
	LIST
	SALL
>  ;END DEFINE N$FATE

DEFINE	N$WARN(A,B,C,%A),<
	SKIPA
	XLIST
	JRST	%A
	PUSHJ	P,FWARN'B
	<SIXBIT \A\>+[ASCIZ \C\]
%A:
	IF1,<IFDEF N$$'A,<PRINTX  ?MULITPLE USE OF ERROR CODE A>>
	N$$'A==0
	LIST
	SALL
>  ;END DEFINE N$WARN

DEFINE	N$INFO(A,B,C,%A),<
	SKIPA
	XLIST
	JRST	%A
	PUSHJ	P,FINFO'B
	<SIXBIT \A\>+[ASCIZ \C\]
%A:
	IF1,<IFDEF N$$'A,<PRINTX  ?MULITPLE USE OF ERROR CODE A>>
	N$$'A==0
	LIST
	SALL
>  ;END DEFINE N$INFO
SUBTTL	Initialization

QUENCH:	TDZA	T1,T1		;ALLOW FOR CCL ENTRY POINT
	MOVEI	T1,1		;YES--FLAG CCL ENTRY
	MOVEM	T1,STRTOF	;SAVE FOR ISCAN
	SETZB	F,TYPER		;CLEAR TYPEOUT ROUTINE FLAG
	RESET			;RESET ANY EXTERNAL I/O
	SETZM	ZCOR		;CLEAR CORE
	MOVE	T1,[ZCOR,,ZCOR+1]
	BLT	T1,EZCOR
	MOVE	P,[IOWD LN$PDL,PDLST]  ;ESTABLISH PUSH-DOWN LIST

IFN FTUUOS,<
	PUSHJ	P,GTTABS	;DO ALL NECESSARY GETTABS
	MOVE	T1,G$PROG	;GET PROGRAM NAME
	SETNAM	T1,		;AND SET IT
	PJOB	T1,		;GET THIS JOB'S NUMBER
	MOVNS	T1		;GET JOB ARG FOR JOBSTS UUO
	JOBSTS	T1,		;GET THIS JOB'S STATUS
	  JRST	.+2		;FAILED--ASSUME LOGGED IN
	TXNE	T1,JB.ULI	;SEE IF LOGGED IN
	TLO	F,L.LOGI	;YES--SET FLAG
	TLNE	F,L.LOGI	;SEE IF LOGGED IN	[1172]
	JRST	QUEST2		;YES--PROCEED			[1172]
	TLO	F,L.NSBJ	;INDICATE NOT LOGGED IN		[1177]
	SETOM	T1		;START AT OUR JOB		[1172]
QUESTL:	CTLJOB	T1,		;GET CONTROLLING NUMBER		[1172]
	  JRST	QUEST2		;NONE--ASSUME OK ANYWAY		[1172]
	JUMPL	T1,QUEST2	;IF NONE, ASSUME OK		[1172]
	MOVN	T2,T1		;GET -JOB			[1172]
	JOBSTS	T2,		;GET ITS STATUS			[1172]
	  SETOM	T2		;ASSUME LOGGED IN		[1172]
	TXNN	T2,JB.ULI	;SEE IF LOGGED IN		[1172]
	JRST	QUESTL		;NO--LOOP ON UP CHAIN		[1172]
	HRLZ	T2,T1		;GET THIS JOB'S NUMBER		[1172]
	HRRI	T2,.GTPPN	;POINT TO PPN TABLE		[1172]
	GETTAB	T2,		;GET PPN FROM MONITOR		[1172]
	  JRST	QUEST2		;NONE!--GIVE UP			[1172]
	MOVEM	T2,.MYPPN##	;OK--USE THAT INSTEAD		[1172]
	TLZ	F,L.NSBJ	;OK AFTER ALL (PROBABLY OPSER CALL)	[1177]
	JRST	QUEST2		;CONTINUE
>  ;END IFN FTUUOS

IFN FTJSYS,<
	TLO	F,L.LOGI	;WE ARE LOGGED IN
	JRST	QUEST2		;CONTINUE
>  ;END IFN FTJSYS
QUEST2:	MOVE	T1,.JBREL	;SAVE CURRENT CORE
	HRL	T1,.JBFF	;  AND START OF FREE CORE	[1202]
	MOVEM	T1,SAVCOR	;  FOR LATER TO RESTORE

	MOVE	T1,[IOWD QCMLEN,QCOMS]  ;NO--RESCAN FOR POSSIBLE COMMANDS
	MOVEM	T1,ISARG	;SET AS FIRST ARG
	MOVE	T1,[STRTOF,,'QUE']  ;SET START ADDRESS AND TMP FILE
	MOVEM	T1,ISARG+1	;STORE AS SECOND ARG
	SETZB	T1,ISARG+3	;CLEAR INDIRECT BLOCK
	MOVEM	T1,MONRTR	;STORE AS FIFTH ARG

	MOVE	T1,[5,ISARG]
	PUSHJ	P,.ISCAN##
	MOVEM	T1,COMIDX	;SAVE COMMAND INDEX
	SKIPGE	T1		;SEE IF COMMAND
	TDZA	T1,T1		;NO--CLEAR DEFAULT TYPE
	MOVE	T1,QDEVS(T1)	;YES--GET QUEUE NAME
	MOVEM	T1,DQTYPE	;STORE AS DEFAULT TYPE
SUBTTL	Main Processing Loop

;HERE WHENEVER * TYPED (IE, MAJOR RESTART)

QUELOP:	PUSHJ	P,GETNOW	;GET NEW TIME OF DAY
	MOVE	T1,[10,,[IOWD SWTCHL,SWTCHN
			SWTCHD,,SWTCHM
			0,,SWTCHP
			'QUEUE '
			CLRANS,,CLRFIL
			INFIL,,OUTFIL
			FILSTK,,APLSTK
			CLRSTK,,0]  ]
	PUSHJ	P,.TSCAN##
	MOVE	T1,COMIDX	;GET COMMAND INDEX
	MOVEI	T1,QCOMS(T1)	;GET ADDRESS IN COMMAND TABLE
	CAIL	T1,MDACOM	;IS IT A MOUNTABLE DEVICE COMMAND?
	N$FATE	<MDC>,,<Mountable Device Commands not implemented>
	SKIPE	O.MODM		;SEE IF OUTPUT SPEC
	JRST	SOMCMD		;YES--NORMAL HANDLING
	MOVE	T1,I.NXZR	;SEE IF ANY COMMANDS
	MOVE	T2,I.INZR	;GET FIRST INPUT SPEC
	SUB	T1,T2		;GET NUMBER OF SPECS*I.LZER
	JUMPE	T1,NOCMD	;NONE--NULL COMMAND
	CAIN	T1,I.LZER	;SEE IF JUST ONE
	SKIPE	.FXNAM(T2)	;  WITH NULL FILE NAME
	JRST	SOMCMD		;NO--SOMETHING THERE
	HLLZ	T1,.FXEXT(T2)	;GET THE EXTENSION
	JUMPN	T1,SOMCMD	;JUMP IF THERE IS ONE

;HERE ON A NULL MONITOR COMMAND

NOCMD:	PUSHJ	P,DEFAU1	;GO FILL IN MODIFIED DEFAULTS
	JRST	DOCMD		;THEN GO BELOW TO DO THE WORK

;HERE WHEN A NON-NULL COMMAND IS FOUND

SOMCMD:	PUSHJ	P,DEFAUL	;GO FILL IN DEFAULTS

;HERE AFTER DEFAULTS ARE DONE

DOCMD:	PUSHJ	P,COMAND	;DO THE COMMAND
	JRST	QUELOP		;LOOP BACK FOR MORE WORK
;COMMANDS WHICH RUN QUEUE
DEFINE	QQ(A,B,C,D,E,F,G,H),<
	SIXBIT	/H/
>

	SIXBIT	/QUEUE/		;SWITCH.INI LINE ON .RUN ETC
QCOMS:	SIXBIT	/QUEUE/
IFGE PUNCDP,<	SIXBIT	/PUNCH/>
	QUEUES
MDACOM:	SIXBIT	/ALLOCA/
	SIXBIT	/FREE/
	SIXBIT	/MOUNT/
	SIXBIT	/DISMOU/
QCMLEN==.-QCOMS

;DEVICES USED BY THOSE COMMANDS
DEFINE	QQ(A,B,C,D,E,F,G,H),<
	SIXBIT	/A/
>

QDEVS:	SIXBIT	/LP/		;QUEUE COMMAND (MUST BE LP NOT LPT) 
IFG	PUNCDP,<SIXBIT /CDP/>
IFE	PUNCDP,<SIXBIT /PTP/>
IFL	PUNCDP,<>
	QUEUES
	SUBTTL	ROUTINES TO HANDLE CALLS FROM TSCAN

;HERE TO CLEAR OUT A SINGLE FILE SPEC

CLRFIL:	SETZM	F.ZER
	MOVE	T1,[F.ZER,,F.ZER+1]
	BLT	T1,F.EZER
	SETOM	F.MIN
	MOVE	T1,[F.MIN,,F.MIN+1]
	BLT	T1,F.EMIN
	POPJ	P,

;HERE WHEN A SPECIFICATION FOR OUTPUT SIDE IS FOUND

OUTFIL:	SKIPN	F.MOD		;ANY MOD SWITCHES?
	SKIPE	F.MODM		; "   "      "
	JRST	OUTFL1		;YES, GIVE ERROR
	SKIPGE	F.STRT		;/START?
	SKIPL	F.RPT		;OR /REPORT?
OUTFL1:	JRST	E.FMO##		;YES, GIVE ERROR
	MOVEI	T1,O.ZER	;POINT TO OUTPUT AREA
	MOVEI	T2,O.LZER	;INDICATE LENGTH
	POPJ	P,		;RETURN

;HERE WHEN A SPECIFICATION FOR INPUT SIDE FOUND

INFIL:	PUSHJ	P,GTCLIN	;GET AND CLEAR INPUT AREA
	MOVEI	T3,I.MOD(T1)	;POINT TO OUR PART
	HRLI	T3,F.ZER	;POINT TO OUR F AREA
	BLT	T3,I.LZER(T1)	;COPY OUR PART
	POPJ	P,		;RETURN
;HERE TO CLEAR STICKY DEFAULTS

CLRSTK:	SETZM	P.ZER		;ZERO OUT DEFAULTS
	MOVE	T1,[P.ZER,,P.ZER+1]
	BLT	T1,P.EZER
	SETOM	P.MIN
	MOVE	T1,[P.MIN,,P.MIN+1]
	BLT	T1,P.EMIN
	POPJ	P,

;CLRANS -- CLEAR SCANNING ANSWER AREA
;CALL:	PUSHJ	P,CLRANS
;USES T1

CLRANS:	HLLZS	F		;CLEAR TEMPORARY FLAGS
	SETZM	S.ZER		;ZERO OUT COMMAND ACCUMULATORS
	MOVE	T1,[S.ZER,,S.ZER+1]
	BLT	T1,S.EZER
	SETOM	S.MIN		;PRESET SWITCH PARAMETERS
	MOVE	T1,[S.MIN,,S.MIN+1]
	BLT	T1,S.EMIN
	MOVE	T1,SAVCOR	;GET INITIAL START OF FREE CORE	[1202]
	HLRZM	T1,.JBFF	;SET START OF FREE CORE		[1202]
	HLRZM	T1,I.INZR	;ESTABLISH PARAMETER AREA HERE	[1202]
	HLRZM	T1,I.NXZR	;AND OF ZERO LENGTH		[1202]
	TLZ	T1,-1		;CLEAR JUNK			[1202]
	CORE	T1,		;RESTORE REAL CORE ALSO		[1202]
	  JFCL			;OK IF CAN'T			[1202]
	POPJ	P,		;RETURN
;FILSTK -- MEMORIZE STICKY DEFAULTS
;CALL:	PUSHJ	P,FILSTK
;	RETURNS AFTER NON-ZERO F.XXX COPIED TO P.XXX
;USES T1, T2

FILSTK:	MOVE	T1,F.MOD	;COPY SWITCHES
	MOVE	T2,F.MODM
	ANDCAM	T2,P.MOD
	IORM	T1,P.MOD
	IORM	T2,P.MODM
	MOVE	T1,F.STRT	;GET THE STARTING POINT
	CAME	T1,[-1]		;WAS IT SPECIFIED?
	MOVEM	T1,P.STRT	; ..
	SETCM	T1,F.RPT	;MEMORIZE /REPORT
	JUMPE	T1,.POPJ##	;RETURN
	DMOVE	T1,F.RPT	;GET /REPORT
	DMOVEM	T1,P.RPT	;AND SAVE IT
	POPJ	P,

;HERE AT END OF SPECIFICATION TO APPLY USER SUPPLIED DEFAULTS

APLSTK:	MOVE	T1,P.MOD	;APPLY ALL FILE SWITCHES
	ANDCM	T1,F.MODM	;MASK HERE USED TO INDICATE WHICH WERE TYPED
	IORM	T1,F.MOD	; ..
	MOVE	T1,P.MODM	; ..
	IORM	T1,F.MODM	; ..
	MOVE	T1,F.STRT	;GET THE STARTING POINT
	CAMN	T1,[-1]		;WAS IT SPECIFIED?
	MOVE	T1,P.STRT	;NO, USE THE GLOBAL DEFAULT
	MOVEM	T1,F.STRT	;NO--SUPPLY DEFAULT
	SETCM	T1,P.RPT	;GET THE REPORT CODE
	JUMPE	T1,.POPJ##	;DONE IF NOT DEFAULT
	SETCM	T1,F.RPT	;SKIP IF NO REPORT GIVEN
	JUMPN	T1,.POPJ##	;RETURN
	DMOVE	T1,P.RPT	;GET /REPORT
	DMOVEM	T1,F.RPT	;SAVE IT
	POPJ	P,		;RETURN
SUBTTL	FILL IN DEFAULTS AFTER COMMAND SCANNING

;DEFAUL -- SUBROUTINE TO FILL IN DEFAULTS AND DETECT
;	INCONSISTENCIES AFTER COMMAND SCANNING
;DEFAU1 -- DITTO EXCEPT DEFAULT OPERATION IS /LIST
;USES EVERYTHING

DEFAUL:	MOVEI	T1,AD.OPN	;FIRST DECIDE WHAT TYPE OF REQUEST
	SKIPL	S.LIST		;SEE IF /LIST SHOWED UP
DEFAU1:	MOVEI	T1,.QORLS	;YES--FORCE /LIST AS DEFAULT
	SKIPGE	S.OPN
	MOVEM	T1,S.OPN
	SKIPL	S.DFR		;WAS /DEFER SPECIFIED?
	POPJ	P,		;YES, RETURN NOW
	MOVE	T1,S.OPN	;FETCH ACTUAL OPERATION		[1171]
	MOVE	T2,O.MODM	;GET INDICATOR OF OUTPUT	[1171]
	CAIE	T1,.QORMD	;SEE IF /MODIFY			[1171]
	CAIN	T1,.QORKL	;OR IF /KILL			[1171]
	SKIPA			;YES, SKIP
	JRST	DEFA1A		;NO, GO ON
	JUMPE	T2,E.SJN	;TYPE "JOB OR SEQ" ON LEFT...
	MOVX	T1,FX.NDV	;GET NULL DEVICE BIT
	TDNN	T1,O.MOD	;WAS IT SET?
	JRST	DEFA1A		;NO, HE SPECIFIED ONE, CONTINUE
	MOVS	T2,DQTYPE	;NO, GET DEFAULT QUEUE TYPE
	SKIPE	DQTYPE		;IS IT IS NULL,
	CAIN	T2,'LP '	; OR JUST  "LP"
	N$FATE	<NQS>,,<No queue specified in /KILL or /MODIFY>

DEFA1A:	PUSHJ	P,QUETYP	;IDENTIFY WHAT TYPE OF QUEUE
	MOVE	J,T1		;SAVE AWAY FOR EASY TESTS LATER
	MOVE	P1,I.INZR	;RESET TO START OF INPUT AREA
	ADDI	P1,I.LZER	;FORCE AT LEAST ONE REQUEST
	SKIPN	J		;SEE IF INPUT QUEUE
	ADDI	P1,I.LZER	;YES--THEREFORE, TWO ENTRIES USED
DEFAU2:	CAMG	P1,I.NXZR	;SEE IF NEED MORE THAN GOT
	JRST	DEFAU3		;NO--OK TO PROCEED
	PUSHJ	P,.CLRFL##	;CLEAR FXXX AREAS
	PUSHJ	P,APLSTK	;APPLY STICKY DEFAULTS
	PUSHJ	P,INFIL		;ALLOCATE SPACE
	PUSHJ	P,.GTSPC##	;COPY SPEC
	JRST	DEFAU2		;LOOP BACK TO SEE IF ENOUGH

DEFAU3:	MOVE	I,I.INZR	;START AT BEGINNING OF REQUESTS
	JUMPN	J,DEFAU4	;IF NOT INPUT QUEUE, WE ARE DONE
	CAMN	P1,I.NXZR	;IF INPUT, AND NOT /LIST, SEE IF GT 2 ENTRIES
	JRST	DEFAU4		;NO--OK TO PROCEED
	N$WARN	<OTE>,,<Input queue request uses only two entries>
	MOVEM	P1,I.NXZR	;CHANGE LIMIT TO AGREE
DEFAU4:	PUSHJ	P,CLRFIL	;CLEAR THE F AREA
	PUSHJ	P,CLRSTK	;CLEAR THE P AREAA
	MOVE	T1,[5,,[IOWD SWTCHL,SWTCHN
			SWTCHD,,SWTCHM
			0,,SWTCHP
			0
			2,,OSCNML]  ]
	MOVX	T2,'QUEUE '	;WHAT TO READ
	MOVEM	T2,OSCNML	;STORE IT
	MOVE	T2,COMIDX	;GET THE COMMAND INDEX
	MOVE	T2,QCOMS(T2)	;GET THE COMMAND
	MOVEM	T2,OSCNML+1	;AND SAVE FOR CALL
	MOVE	I,S.OPN		;GET OPERATION WORD
	CLEARM	CREFLG		;ASSUME IT'S CREATE
	CAIE	I,.QORMD	;IS IT MODIFY?
	CAIN	I,.QORKL	;OR KILL?
	  SOSA	CREFLG		;IT'S NOT CREATE!!
	PUSHJ	P,.OSCAN##	;LOOK AT OPTION FILE


IFN FTUUOS,<
	SETOM	PTHFCN		;SET TO READ DEFAULT
	MOVE	T1,[.PTMAX,,PTHFCN]
	PATH.	T1,		;  READ IT
	  SETZM	PTHPPN		;CAN'T--ASSUME DEFAULT
	SKIPN	PTHPPN		;SEE IF SET
	SETZM	PTHPPN+1	;NO--CLEAR SFDS
	MOVE	T1,.MYPPN##	;GET SELF
	SKIPN	PTHPPN		;SEE IF DEFAULT KNOWN
	MOVEM	T1,PTHPPN	;NO--THEN USE SELF
>  ;END IFN FTUUOS

IFN FTJSYS,<
	MOVE	T1,.MYPPN##	;GET MY PPN
	MOVEM	T1,PTHPPN	;SAVE IN PATH
	SETZM	PTHPPN+1	;CLEAR SFDS
>  ;END IFN FTJSYS

	MOVEI	T1,O.ZER	;SETUP ARGS FOR OSDFS
	MOVEI	T2,O.LZER	; "
	SKIPN	CREFLG		;IS IT CREATE?
	PUSHJ	P,.OSDFS##	;YES, DO SWITCH INI DEFAULTING

	CAIE	I,.QORLS	;SEE IF LISTING DEVICE
	JRST	OUDEF1		;NO--NOT A REAL DEVICE
	MOVSI	T1,'TTY'	;SET DEFAULT DEVICE
	SKIPN	P1,O.DEV	;YES--CHECK DEVICE CHARACTERISTICS
	MOVE	P1,T1		;NO DEVICE--USE DEFAULT
	MOVEM	P1,O.DEV	;SAVE FOR LATER
	MOVE	T1,O.MOD	;GET MOD WORD
	TXNE	T1,FX.PHY	;SEE IF PHYS I/O NEEDED
	DEVCHR	P1,UU.PHY	;YES--TRY IT
	TXNN	T1,FX.PHY	;SEE IF NOT
	DEVCHR	P1,		;NO--USE LOGICAL FROM THE MONITOR
	TXNN	P1,DV.OUT	;SEE IF CAPABLE OF OUTPUT
	JRST	E.NOD		;NO--TELL USER HE BLEW IT
	JRST	OUDEF2		;YES--PROCEED(WARNING--P1 USED BELOW)
OUDEF1:	SETZM	DQTYPE		;ONLY ONE TIME FOR PRINT TYPE COMMANDS
	MOVX	T1,FX.NDV	;CLEAR OUT
	ANDCAM	T1,O.MOD	; NULL DEVICE FLAG
	SKIPE	O.EXT		;SKIP IF EXTENSION IS ZERO
	N$FATE	<OEI>,,<Output Extension is Illegal>

OUDEF2:	CAIN	I,.QORLS	;SEE IF LISTING
	JRST	OUDF2A		;YES--SKIP ONWARD
	MOVE	T1,O.MOD	;GET OUTPUT FLAGS
	TXNE	T1,FX.DIR	;WAS A DIRECTORY SPECIFIED?
	JRST	OUDF2B		;YES, CONTINUE ON
	SETOM	O.DIRM		;NO, SET DIRECTORY MASK
	JRST	OUDF2A		;AND CONTINUE ON
OUDF2B:	MOVE	T1,.MYPPN##	;GET SELF
	MOVSI	T2,-1		;MASK LEFT HALF
	TDNN	T2,O.DIR	;SEE IF SET
	HRROS	O.DIRM		;NO--PUT ON MASK
	TDNN	T2,O.DIR	; ..
	HLLM	T1,O.DIR	;SET IN SELF PROJECT
	MOVEI	T2,-1		;MASK RIGHT HALF
	TDNN	T2,O.DIR	;SEE IF SET
	HLLOS	O.DIRM		;NO--PUT ON MASK
	TDNN	T2,O.DIR	; ..
	HRRM	T1,O.DIR	;SET IN SELF PROGRAMMER
	SKIPE	O.DIR+2		;CHECK FOR SFDS
	JRST	E.QSFD		;ILLEGAL IN QUEUE USER
	JRST	OUDEF4		;SKIP ON
OUDF2A:	SKIPN	O.NAM
	TXNN	P1,DV.DIR	;YES--SEE IF FILE NAME NEEDED(WARNING--P1 FROM ABOVE)
	JRST	OUDEF4		;NO--GO ON
	MSTIME	T1,		;YES--MANUFACTURE NAME HHMMSS
	IDIVI	T1,^D1000	;GET SECONDS
	MOVE	T4,[POINT 6,O.NAM]  ;SETUP BYTE POINTER
	MOVSI	T3,-6		;INITIALIZE LOOP COUNTER
OUDEF3:	IDIV	T1,[^D36000
		    ^D3600
		    ^D600
		    ^D60
		    ^D10
		    ^D1](T3)	;GET NEXT DIGIT
	ADDI	T1,'0'		;CONVERT TO SIXBIT DIGIT
	IDPB	T1,T4		;STORE INTO NAME
	MOVE	T1,T2		;RESTORE REMAINDER
	AOBJN	T3,OUDEF3	;LOOP
	N$INFO	<QLF>,<N>,<Queue listing on file>
	MOVE	T1,O.NAM	;GET NAME
	PUSHJ	P,.TSIXN
	MOVEI	T1,"."		;OUTPUT SEPARATOR		[1174]
	PUSHJ	P,.TCHAR##	; ..				[1174]
	HRLOI	T1,'LSQ'	;GET DEFAULT EXTENSION
	SKIPN	O.EXT		;ONE SPECIFIED?
	MOVEM	T1,O.EXT	;NO, USE THE DEFAULT
	HLLZ	T1,O.EXT	;GET EXTENSION			[1174]
	PUSHJ	P,.TSIXN##	;OUTPUT IT			[1174]
	PUSHJ	P,FINFO2	;CLOSE OFF THE MESSAGE
	SETOM	O.NAMM		;CLEAR MASK TO NO WILD-CARDS

OUDEF4:	SKIPE	CREFLG		;SEE IF MODIFY
	JRST	OUDEF5		;YES--WILD CARDS ARE LEGAL
	MOVE	T1,[O.LZER,,O.ZER] ;SETUP TO CALL .STOPN
	MOVEI	T2,L.OPEN	;OPEN BLOCK
	MOVE	T3,[LN$ENT,,L.LOOK]
	PUSHJ	P,.STOPN##	;CALL .STOPN
	  N$FATE <OWI>,,<Output Wildcards are Illegal>
	JRST	INDEF		;AND CONTINUE
OUDEF5:	SKIPGE	S.SEQ		;SEE IF /SEQ			[1173]
	SKIPE	O.NAM		;NO--SEE IF NAME		[1173]
	SKIPA			;YES--OK			[1173]
	N$FATE	<NSR>,,<Jobname or /SEQUENCE required>
;HERE TO SUPPLY INPUT SIDE DEFAULTS

INDEF:	MOVE	J,QTYPE		;GET QTYPE IN J
	MOVE	I,I.INZR	;INITIALIZE LOOP

;LOOP HERE TO DEFAULT NEXT INPUT FILE

INDEF1:	SKIPE	CREFLG		;SEE IF /MODIFY
	JRST	INDEFY		;YES--SKIP TO NAME TESTS
	MOVEI	T1,0(I)		;START SETTING UP TO CALL OSDFS
	MOVEI	T2,.FXLEN	;ADR AND LEN
	PUSHJ	P,.OSDFS##	;CALL IT
	MOVE	T1,F.MOD	;GET MOD WORD
	ANDCM	T1,I.MODM(I)	;TEST
	IORM	T1,I.MOD(I)	;AND SET
	MOVE	T1,F.MODM	;GET GET MOD WORD MASK
	IORM	T1,I.MODM(I)	;AND OR IT IN
	MOVE	T1,I.STRT(I)	;GET START PARAMETER
	CAMN	T1,[-1]		;SET?
	MOVE	T1,F.STRT	;NO, GET DEFAULT
	MOVEM	T1,I.STRT(I)	;STORE IT
	MOVE	T1,I.RPT(I)	;GET /REPORT
	MOVE	T2,I.RPT+1(I)	;AND SECOND HALF
	CAMN	T1,[-1]		;WAS IT SET?
	MOVE	T2,F.RPT+1	;NO, GET DEFAULT
	CAMN	T1,[-1]		;TEST AGAIN
	MOVE	T1,F.RPT	;AND GET FIRST HALF
	MOVEM	T1,I.RPT(I)	;STORE FIRST HALF
	MOVEM	T2,I.RPT+1(I)	;STORE SECOND HALF

	MOVSI	T1,'DSK'	;DEFAULT DEVICE
IFN FTUUOS,<
	CAME	I,I.INZR	;IS THIS THE FIRST SPEC?
	MOVE	T1,.FXDEV-I.LZER(I) ;NO, USE DEVICE FROM LAST SPEC
>  ;END IFN FTUUOS
	JUMPGE	J,INDF1A	;JUMP IF NOT /LIST
	MOVE	T1,DQTYPE	;GET DEFAULT QUEUE
	TLNN	T1,(77B17)	;IS IT FROM QUEUE COMMAND?
	SETZ	T1,		;YES--DEFAULT IS ALL:
INDF1A:	MOVX	T2,FX.NDV	;SEE IF
	TDNN	T2,.FXMOD(I)	;  NULL DEVICE
	SKIPN	.FXDEV(I)
	MOVEM	T1,.FXDEV(I)
	JUMPN	J,INDEFF	;IF NOT INPUT QUEUE, PROCEED
	SETOM	T1		;INPUT NOT /LIST, SO NO WILDCARDS
	CAME	T1,.FXNMM(I)	;TEST NAME WILD
	SKIPN	.FXNAM(I)	;YES--SEE IF NAME THERE
	JRST	.+2		;NO--THEN OK
	JRST	E.WCI		;YES--ILLEGAL
	MOVEI	T1,0		;CLEAR DEFAULT
	CAME	I,I.INZR	;IF NOT FIRST FILE,
	MOVE	T1,.FXNAM-I.LZER(I)  ;  DEFAULT TO PREVIOUS FILE
	SKIPN	T2,O.NAM	;GET JOB NAME
	MOVE	T2,T1		;IF NO JOB NAME, DEFAULT IS CTL FILE
	SKIPN	T1,.FXNAM(I)	;SEE IF NAME SUPPLIED
	MOVE	T1,T2		;NO--GET DEFAULT NAME
	JUMPE	T1,E.NNI	;ERROR IF NONE
	MOVEM	T1,.FXNAM(I)	;AND STORE RESULT
	SETOM	.FXNMM(I)	;REMOVE WILDCARD FROM NAME

INDEFF:	SKIPE	.FXNAM(I)	;DEFAULT FILE NAME
	JRST	INDEFX		;NO DEFAULT NEEDED
	CAME	I,I.INZR	;SEE IF FIRST FILE
	SKIPA	T1,.FXNAM-I.LZER(I)  ;NO--USE PREVIOUS FILE NAME
	MOVSI	T1,'*  '	;YES--SUPPLY WILD DEFAULT
	MOVEM	T1,.FXNAM(I)
	CAME	I,I.INZR	;SEE IF FIRST
	SKIPA	T1,.FXNMM-I.LZER(I)  ;NO--USE PREVIOUS MASK
	MOVEI	T1,0		;YES--USE WILD MASK
	MOVEM	T1,.FXNMM(I)	; ..
INDEFX:	SKIPE	.FXEXT(I)	;DEFAULT EXTENSION
	JRST	INDEFY		;NOT NEEDED
	MOVSI	T1,'*  '	;SET DEFAULT FOR /MODIFY
	SKIPE	CREFLG		;SEE IF /MODIFY
	JRST	INDEF2		;YES--GO STORE DEFAULT
	JUMPL	J,INDEFY
	MOVE	T1,INDFXT(J)	;GET EXTENSION
	CAMN	I,I.INZR	;SEE IF FIRST FILE
	JRST	INDFLG		;YES--PROCEED BELOW
	JUMPN	J,INDFLG	;IF SUBSEQUENT AND INPUT QUEUE,
	MOVSI	T1,'LOG'	;  CHANGE TO LOG
	MOVX	T2,X.NEW!X.LOG	;SET /NEW/LOG
	IORM	T2,I.MOD(I)	;  INTO REQUEST
INDFLG:	TRO	T1,-1		;SET MASK TO BELIEVE WHOLE EXT
INDEF2:	MOVEM	T1,.FXEXT(I)	;STORE IT
INDEFY:	SKIPE	CREFLG		;SEE IF /MODIFY
	JRST	INDEF3		;YES--SKIP TO DIRECTORY TESTS
	JUMPN	J,INDEF3	;IF NOT INPUT QUEUE, PROCEED
	SETCM	T1,.FXEXT(I)	;INPUT AND NOT /LIST--SEE IF
	TRNE	T1,-1		;  EXTENSION HAS WILDCARD
	JRST	E.WXI		;YES--ILLEGAL

INDEF3:	MOVX	T1,FX.DIR	;GET DIRECTORY BIT
	JUMPGE	J,INDFNL	;JUMP IF NOT /LIST
	SKIPE	.FXDIR+2(I)	;SEE IF LISTING SFDS
	JRST	E.LSFD		;YES--THAT'S WRONG
	SKIPN	T2,O.DIR	;GET OUTPUT DIRECTORY
	MOVE	T2,.MYPPN##	;OR LOGGED IN NUMBER
	TDNE	T1,.FXMOM(I)	;SEE IF DIRECTORY PRESENT
	JRST	INDFTU		;YES--GO SET USER'S DEFAULTS
	SETOM	.FXDIR(I)	;NO--SET FOR ALL USERS
	JRST	INDFNM		;AND INDICATE DIRECTORY SET
INDFNL:	SKIPE	T2,O.DIR	;ACTION REQUEST--SEE IF
	CAMN	T2,.MYPPN##	;  FOR SPECIFIC USER
	JRST	INDEFD		;NO--PROCEED
INDFTU:	MOVSI	T3,-1		;YES--USE HIM FOR DEFAULT
	TDNN	T3,.FXDIR(I)	;CHECK FOR PROJECT
	HRROS	.FXDIM(I)	;BLANK--SET IT
	TDNN	T3,.FXDIR(I)	; ..
	HLLM	T2,.FXDIR(I)	; TO QUEUED USER
	MOVEI	T3,-1		;CHECK FOR
	TDNN	T3,.FXDIR(I)	; PROGRAMMER NUMBER
	HLLOS	.FXDIM(I)	;BLANK--SET IT
	TDNN	T3,.FXDIR(I)	; ..
	HRRM	T2,.FXDIR(I)	; TO QUEUED USER
INDFNM:	IORM	T1,.FXMOD(I)	;INDICATE DIRECTORY
	IORM	T1,.FXMOM(I)	; SPECIFIED
INDEFD:	SKIPE	CREFLG		;SEE IF /MODIFY
	JRST	INDNOK		;YES--SKIP TO SWITCH TESTS
	JUMPN	J,INDEF4	;IF NOT INPUT QUEUE, PROCEED
	MOVE	T1,.FXDIR(I)	;GET DIRECTORY
	SETCM	T2,.FXDIM(I)	;AND COMPLEMENT OF MASK
	TLNN	T1,-1		;SEE IF PROJECT DEFAULT
	TLZ	T2,-1		;YES--CLEAR WILD-CARDS
	TRNN	T1,-1		;SEE IF PROGRAMMER DEFAULT
	TRZ	T2,-1		;YES--CLEAR WILD-CARDS
	JUMPN	T2,E.WDI	;ERROR IF WILD UFD
	SETOM	T1		;INPUT--CHECK FOR WILD DIRECTORY
	MOVEI	T2,2(I)		;SET POINTER TO SPEC
	HRLI	T2,1-.FXLND	;COUNT SFD DEPTH
INDFNN:	SKIPN	.FXDIR(T2)	;SEE IF SPECIFIED
	JRST	INDEF4		;NO--ALL DONE
	CAME	T1,.FXDIM(T2)	;SEE IF NOT WILD
	JRST	E.WDI		;ERROR IF SO
	ADDI	T2,1		;ADVANCE COUNT
	AOBJN	T2,INDFNN	;LOOP OVER SFD DEPTH
INDEF4:	MOVE	T1,INDADS	;ABSENT DEFAULTS FOR SWITCHES
	JUMPN	J,INDEFO	;JUMP IF NOT INPUT QUEUE
	CAME	I,I.INZR	;IF INPUT AND LOG FILE,
	MOVE	T1,INDADI	; USE SPECIAL SET
INDEFO:	ANDCM	T1,I.MODM(I)	;MASK TO ONLY THE NEEDED ONES
	IORB	T1,I.MOD(I)	;AND INCLUDE
	TXNN	T1,X.NEW	;SEE IF /NEW
	JRST	INDNOK		;NO--NULL EXT HACK OK
	MOVX	T2,FX.NUL	;YES--CLEAR NULL EXT
	ANDCAM	T2,.FXMOD(I)	; FLAG IN REQUEST

INDNOK:	LDB	T1,[POINTR (I.MOD(I),X.REMV)]	;GET /REMOVE SWITCH
	SKIPE	T1				;WAS IT SET?
	SKIPE	CREFLG				;YES, IS THIS /MOD?
	  SKIPA					;ALL IS OK
	N$FATE	<ROM>,,</REMOVE is legal on MODIFY requests only>
	LDB	T1,[POINTR (I.MOD(I),X.PAPR)]  ;GET /PAPER: SWITCH
	CAIN	J,QTPCDP	;IS IT THE CARD-PUNCH QUEUE?
	CAIE	T1,PUNCBCD	;YES, DID HE SAY /PUNCH:BCD
	  SKIPA			;NOT CDP OR NOT /PUN:BCD
	MOVEI	T1,PUNC026	;YES, BCD=026
	DPB	T1,[POINTR (I.MOD(I),X.PAPR)] ;AND STORE IT

	MOVEI	T1,AD.STR	;GET DEFAULT STARTING POINT
	SKIPE	CREFLG		;SEE IF /MODIFY
	MOVEI	T1,0		;YES--CLEAR DEFAULT
	MOVE	T2,I.STRT(I)	;GET SPECIFIED VALUE
	CAMN	T2,[-1]		;WAS IT SPECFIED?
	MOVEM	T1,I.STRT(I)	;NO--USE DEFAULT
	JUMPGE	J,INDEF7	;JUMP IF NOT /LIST

	SKIPE	N,.FXDEV(I)	;/LIST--GET QUE NAME
	PUSHJ	P,XPNQUE	;EXPAND ABBREVIATION
	MOVEM	N,.FXDEV(I)	;AND STORE RESULT

INDEF7:	ADDI	I,I.LZER	;ADVANCE POINTER
	CAMGE	I,I.NXZR	;SEE IF DONE YET
	JRST	INDEF1		;NO--LOOP BACK
;HERE TO SUPPLY DEFAULTS FOR GLOBAL SWITCHES

	SKIPE	CREFLG		;SEE IF /MODIFY
	JRST	SWDEF2		;YES--SKIP DEFAULT SWITCHES
	MOVSI	T1,-S.EMIN+S.MIN-1  ;INITIALIZE LOOP
SWDEF1:	MOVE	T2,SWDEFT(T1)	;GET DEFAULT
	MOVE	T3,S.MIN(T1)	;GET VALUE ENTERRED
	CAMN	T3,[-1]		;SEE IF ANYTHING TYPED
	MOVEM	T2,S.MIN(T1)	;YES--STUFF DEFAULT
	AOBJN	T1,SWDEF1	;LOOP BACK FOR MORE

	JUMPLE	J,SWDEF2	;JUMP IF /LIST OR INP:
	MOVE	T2,@SWLDT(J)	;GET ALTERNATE LIMIT VALUE
	SKIPG	S.LIM		;WAS /LIM SET?
	MOVEM	T2,S.LIM	;NO, SAVE ALTERNATE VALUE

SWDEF2:	SKIPGE	S.SEQ		;SEE IF SEQUENCE STILL NOT SET
	SETZM	S.SEQ		; RIGHT--SET IT FOR /MOD/KILL
	MOVE	T1,S.COR	;LOOK AT CORE SIZE
	JUMPLE	T1,SWDEF3	;IF DEFAULT, LEAVE ALONE
	CAIGE	T1,^D256	;SEE IF ALREADY IN WORDS
	LSH	T1,^D10		;NO--ADD K FACTOR
	MOVEM	T1,S.COR	;STORE RESULT

	SKIPN	DEFFIL+.FXDEV	;SEE IF /PATH
	JRST	SWDEF3		;NO--PROCEED
	SKIPN	DEFFIL+.FXNAM	;SEE IF /PATH:NAME
	SKIPL	DEFFIL+.FXMOD	; OR /PATH:DEV:
	....==FX.NDV
	JRST	E.PTHN		;ERROR IF SO
	SKIPE	DEFFIL+.FXEXT	; OR /PATH:.EXT
	JRST	E.PTHN		;ERROR IF SO
SWDEF3:	SKIPE	CREFLG		;SEE IF /MODIFY
	POPJ	P,		;YES--RETURN
	JUMPL	J,.POPJ		;GO PROCESS IF /LIST
	JUMPN	J,SWDEF4	;PROCEED IF NOT INPUT
	MOVX	T1,FX.DIR	;GET [] BIT
	TDNE	T1,DEFFIL+.FXMOM  ;SEE IF /PATH:[]
	JRST	SWDPTD		;YES--JUST CHECK NOT WILD
	MOVE	T2,.MYPPN##	;NO--GET SELF
	SKIPN	O.DIR+2		;SEE IF NOT OUTPUT SFD
	CAME	T2,O.DIR	;SEE IF MATCHES OUTPUT P,PN
	TDNN	T1,O.MODM	;OR NO OUTPUT P,PN
	JRST	SWDPTS		;RIGHT--USE DEFAULT DIRECTORY
	MOVE	T1,[O.DIR,,DEFDIR] ;NO--COPY
	BLT	T1,DEFDIR+2*.FXLND-1  ;OUTPUT DIRECTORY
	JRST	SWDPTD		;THEN CHECK FOR NO WILD-CARDS
SWDPTS:	MOVSI	T2,-.FXLND	;GET LOOP COUNT
	MOVEI	T3,0		;AND STORE INDEX
SWDPTL:	SKIPN	T1,PTHPPN(T2)	;GET DEFAULT PATH
	SOS	T2		;DEFEAT ADVANCE IF DONE
	MOVEM	T1,DEFDIR(T3)	;STORE IN /PATH
	SETOM	DEFDIR+1(T3)	;CLEAR WILDCARDS
	ADDI	T3,2		;ADVANCE STORE
	AOBJN	T2,SWDPTL	;LOOP UNTIL DONE
SWDPTD:	MOVE	T1,DEFDIR	;GET UFD
	SKIPN	T2,O.DIR	;GET OUTPUT DIRECTORY
	MOVE	T2,.MYPPN##	;DEFAULT TO LOGGED IN DIRECTORY
	TLNN	T1,-1		;SEE IF PROGRAMMER
	HLL	T1,T2		;NO--DEFAULT
	TRNN	T1,-1		;SEE IF PROGRAMMER
	HRR	T1,T2		;NO--DEFAULT
	MOVEM	T1,DEFDIR	;STORE AWAY
	MOVSI	T2,-.FXLND	;SET LOOP COUNT
SWDPTM:	SKIPN	DEFDIR(T2)	;SEE IF NEXT LEVEL SPECIFIED
	JRST	SWDEF4		;NO--ALL OK
	SETCM	T1,DEFDIR+1(T2)	;GET COMPLEMENT OF WILD MASK
	JUMPN	T1,E.PTHW	;ERROR IF WASN'T -1
	ADDI	T2,1		;ADVANCE BY 2
	AOBJN	T2,SWDPTM	;LOOP OVER FULL DEPTH

SWDEF4:	MOVE	I,I.INZR	;DEFAULT JOB NAME IS FIRST FILE NAME
	CAIN	J,0		;UNLESS INPUT QUEUE
	ADDI	I,I.LZER	;FOR WHICH IT IS LOG FILE
	SETCM	T1,.FXNMM(I)	;SEE IF WILDCARD IN FILE
	JUMPN	T1,.POPJ	;YES--JUST PROCESS
	MOVE	T1,.FXNAM(I)	;NO--GET FILE NAME IN CASE
	SKIPN	O.NAM		;SEE IF OUTPUT NAME YET
	MOVEM	T1,O.NAM	;NO--SET THIS ONE
	POPJ	P,		;RETURN
INDADS:	BYTE (6)AD.NHD(12)0(3)SPACSI,0,0,0(6) AD.COP ;DEF. FILE SWITCHES
INDADI:	BYTE (3)1 (3)AD.NHD (12)0 (3) SPACSI,0,FILEAS,AD.LFD (6)AD.COP  ;INPUT QUEUE LOG FILE

;DEFINITION OF SWITCH ACCUMULATION AREA AND DEFAULT VALUES
;
;EACH ENTRY IN QSM MACRO IS:
;	SMX	SWITCH-LOCATION,DEFAULT

DEFINE QSM,<
	SMX	S.AFT,0
	SMX	S.ALLF,0
	SMX	S.CNO,0
	SMX	S.COR,0
	SMX	S.DED,0
	SMX	S.DFR,0
	SMX	S.DPN,0
	SMX	S.FRM,0
	SMX	S.LCDP,0
	SMX	S.LIM,0
	SMX	S.LIST,-1
	SMX	S.LLPT,0
	SMX	S.LPLT,0
	SMX	S.LPTP,0
	SMX	S.LTIM,0
	SMX	S.NOT1,0
	SMX	S.NOT2,0
	SMX	S.NULL,0
	SMX	S.OPN,0
	SMX	S.OUT,0
	SMX	S.PRI,0
	SMX	S.RSTR,AD.RST
	SMX	S.SEQ,0
	SMX	S.UNIQ,AD.UNI
	SMX	S.USER,-1
>  ;END DEFINE QSM

	S.LINP==0		;DUMMY

	S.NOT==S.NOT1
;FIRST DEFINE THE TABLE OF DEFAULTS

DEFINE SMX(A,B),<
	XLIST
	EXP	B
	LIST
	SALL
>

SWDEFT:	QSM


;NOW DEFINE THE ACCUMULATION TABLE

DEFINE SMX(A,B,C),<
	XLIST
A:	BLOCK	1
	LIST
	SALL
>

	SWSEG				;SWITCH TO LOWSEG
S.MIN:!
	QSM
	S.EMIN==.-1
	SWSEG				;SWITCH BACK TO HISEG
	XALL

;DEFAULT EXTENSIONS FOR QUEUES
DEFINE	QQ(A,B,C,D,E,F,G,H),<
	SIXBIT	/B/
>
INDFXT:	QUEUES

;LOCATIONS OF INDIVIDUAL QUEUE LIMITS
DEFINE QQ(A,B,C,D,E,F,G,H),<
	EXP	S.L'A
>
SWLDT:	QUEUES

	SALL
;FILE SCANNING ERRORS

E.NOD:	MOVE	N,O.DEV
	N$FATE	<CDO>,<N>,<Can not do output to device>
E.NDD:	MOVE	N,.FXDEV(I)
	N$FATE	<DND>,<N>,<Input device not a disk>
E.WCI:	MOVE	N,.FXNAM(I)
	N$FATE	<WIQ>,<N>,<Wildcard illegal in input queue file name>
E.WDI:	N$FATE	<WDI>,,<Wildcard illegal in input queue file directory>
E.WXI:	HLLZ	N,.FXEXT(I)
	N$FATE	<WIE>,<N>,<Wildcard illegal in input queue file extension>
E.NNI:	N$FATE	<FRI>,,<Filename required for input queue>
E.QSFD:	N$FATE	<UCI>,,<Queue user cannot include SFDs>
E.LSFD:	N$FATE	<LQU>,,<Listed queue user cannot include SFDs>
E.PTHN:	N$FATE	<FNI>,,<File name illegal in default path>
E.PTHW:	N$FATE	<WID>,,<Wildcard illegal in default path>

E.SJN:	N$FATE	<SJN>,,<Specify jobname left of equal sign>

E.NSD:	MOVE	N,.FXDEV(I)
	N$FATE	<NSD>,<N>,<Input device does not exist>


E.WIN:	N$FATE	<WIN>,,<Wildcards illegal with /NEW>
SUBTTL	COMMAND PROCESSING

;COMAND -- SUBROUTINE TO PROCESS COMMAND
;USES EVERYTHING

;HERE AFTER COMMAND HAS BEEN DECODED AND ALL DEFAULTS SUPPLIED
;DISPATCH TO APPROPRIATE COMMAND PROCESSOR

COMAND:	SKIPLE	I,S.OPN		;FETCH OPERATION CODE, CHECK FOR LEGAL
	CAILE	I,LCDT		;CHECK FOR VALIDITY
	JRST	E.ICMD		;NO--BOMB THE USER
	MOVE	T1,DQTYPE	;GET COMMAND-DEVICE
	MOVEM	T1,COMDEV	;AND SAVE FOR LATER
	SETZM	T.ZER		;ZERO OUT TEMPORARIES
	MOVE	T1,[T.ZER,,T.ZER+1]  ; ..
	BLT	T1,T.EZER	; ..
	MOVE	Q,.JBFF		;SETUP POINTER TO QUEUE AREA
	GCORE	Q.ILEN		;GRAB MINIMAL AREA AT FIRST
	SETZM	(Q)		;ZERO OUT QUEUE COMMAND AREA
	HRLZI	T1,(Q)		; ..
	HRRI	T1,1(Q)		; ..
	BLT	T1,Q.ILEN-1(Q)	; ..
	MOVE	T1,CDTAB-1(I)	;GET ADDRESS AND CONTROL BITS
	SKIPLE	S.DFR		;WAS /DEFER SPECIFIED?
	HRRI	T1,DEFER	;YES, DISPATCH TO DEFER ROUTINE
	TLNE	T1,(NNLGSB)	;SEE IF ERROR AS SUBJOB		[1177]
	TLNN	F,L.NSBJ	;NO--SEE IF TOP IS LOGGED IN	[1177]
	SKIPA			;YES--LEAVE ALONE		[1177]
	TLO	T1,(NNLGI)	;NO--INDICATE ERROR		[1177]
	TLNN	F,L.LOGI	  ;SEE IF LOGGED IN
	TLNN	T1,(NNLGI)	;NO--SEE IF LEGAL IF NOT
	JRST	(T1)		;YES--GO DO IT
	MOVE	N,CMDTAB-1(I)	;ILLEGAL--ABORT
	N$FATE	<LFS>,<N>,<LOGIN please to use switch>


;TABLE OF DISPATCH ADDRESSES FOR VARIOUS COMMANDS
NNLGI==1B1		;NOT LEGAL UNLESS LOGGED IN
NNLGSB==1B2		;NOT LEGAL UNLESS LOGGED IN AT TOP LEVEL	[1177]

CDTAB:
	EXP	CREATE+NNLGI		;1=CREATE ENTRY
	EXP	0			;2 WAS /DEFER
	EXP	0			;3 WAS /ZDEFER
	EXP	LIST			;4=LIST QUEUE
	EXP	MODIFY+NNLGSB		;5=MODIFY EXISTING ENTRY	[1177]
	EXP	KILL+NNLGSB		;6=KILL EXISTING ENTRY	[1177]
LCDT==.-CDTAB
;HERE ON IMPROPER DISPATCH CODE

E.ICMD:	HRRZ	N,I
	N$FATE	<ICC>,<D>,<Improper command code>


CMDTAB:	SIXBIT	/CREATE/
	EXP	0,0
	SIXBIT	/LIST/
	SIXBIT	/MODIFY/
	SIXBIT	/KILL/
SUBTTL	Command Processing  --  DEFER

;/DEFER IS A GALAXY-10 FEATURE WHICH ALLOWS A USER TO MANIPULATE 
;	DEFER'ED SPOOLING REQUESTS.  TWO FUNCTIONS CURRENTLY EXIST:
;		/CREATE/DEFER  --  RELEASES REQUESTS TO THE 
;					PROPER QUEUES
;		/KILL/DEFER    --  KILLS REQUESTS

DEFER:	MOVE	T2,S.OPN		;GET THE OPERATION SPECIFIED
	SETZ	T1,			;CLEAR T1
	CAIN	T2,.QORCR		;/CREATE?
	MOVEI	T1,.QORDF		;YES, PASS DEFER FUNCTION
	CAIN	T2,.QORKL		;/KILL?
	MOVEI	T1,.QORZD		;PASS /ZDEFER
	SKIPN	T1			;MUST BE ONE OR THE OTHER
	N$FATE	<DMI>,,</DEFER request must include /CREATE or /KILL>
	MOVEM	T1,Q.OPR(Q)		;AND STORE IN Q.OPR
	SKIPE	N,O.DEV			;DID HE TYPE A DEVICE?
	PUSHJ	P,XPNQUE		;YES, EXPAND IT
	MOVEM	N,O.DEV			;AND STORE IT BACK
	MOVS	T1,COMDEV		;GET COMMAND-DEVICE
	CAIN	T1,'LP '		;DID HE SAY .QUEUE?
	SETZM	COMDEV			;YES, NO SPECIAL DEVICE
	SKIPN	T1,O.DEV		;GET SPECIFIED DEVICE
	MOVE	T1,COMDEV		;NONE THERE, USE COMMAND-DEVICE
	MOVEM	T1,Q.DEV(Q)		;SAVE DEVICE IN Q.DEV
	MOVEI	T1,0(Q)			;GET ADDRESS FOR QMANGR
	HRLI	T1,Q.ILEN		;AND LENGTH
	PJRST	.QUEER##		;AND DO IT
SUBTTL	COMMAND PROCESSING -- LIST

;HERE TO LIST SOME CROSS-SECTION OF THE QUEUES

LIST:	MOVE	I,I.INZR	;START WITH FIRST REQUEST
	MOVSI	T1,B.LC		;POINT TO BUFFER HEADERS
	MOVEM	T1,L.OPEN+2	;STORE IN OPEN BLOCK
	MOVEI	T1,LN$ENT-1	;SET LENGTH OF BLOCK
	IORM	T1,L.LOOK	;  INTO LOOKUP BLOCK
	MOVS	T1,L.OPEN+1	;GET OUTPUT DEVICE
	CAIE	T1,'TTY'	;IF TTY:
	TLNE	F,L.LOGI	; OR LOGGED IN,
	JRST	LIST1		;THEN OK TO LIST
	TLNE	F,L.NSBJ	;ARE WE LOGGED IN AT TOP LEVEL?
	N$FATE	<LTL>,<N>,<LOGIN to list on device>

LIST1:	MOVE	N,O.DEV		;GET DEVNAME IN CASE THIS FAILS
	OPEN	LC,L.OPEN	;INIT THE DEVICE
	  N$FATE <LOF>,<N>,<Listing OPEN failure on device>
	SKIPN	T1,O.NAM	;GET FILE NAME FOR ENTER
	JRST	LISTST		;GO TO WORK IF NO ENTER NEEDED

	ENTER	LC,L.LOOK	;ENTER FILE
	  JRST	E.OEFE		;ERROR

LISTST:	MOVE	T1,O.DEV	;GET OUTPUT DEVICE
	MOVE	T2,[DEVCHR T1,]  ;GET UUO
	MOVX	T3,FX.PHY	;GET /PHYS BIT
	TDNE	T3,O.MOD	;OR ASKED FOR
	TXO	T2,UU.PHY	;YES--SET BIT
	XCT	T2		;DO THE UUO
	TXNE	T1,DV.TTY	;SEE IF LINE MODE OUTPUT DEVICE
	TRO	F,R.OUTL	;YES--SET FLAG TO FORCE OUT EACH LINE
	OUTBUF	LC,0		;ALLOCATE BUFFERS BEFORE QMANGR MANGLES FREE CORE
	SETZM	LSTZER		;CLEAR OUT THE TEMPS
	MOVE	T1,[LSTZER,,LSTZER+1] ; USED BY THE LISTING ROUTINE
	BLT	T1,LSTEZR-1	; ..
	HLLZ	T1,.FXDEV(I)	;GET GENERIC QUEUE
	MOVEM	T1,ONEQUE	;SAVE FOR TOTALS TEST
;HERE TO PROCESS ONE INPUT REQUEST

LISTL:	CAML	I,I.NXZR	;SEE IF WE ARE DONE YET
	JRST	LISTE		;YES--CLOSE LISTING FILE
	MOVE	T1,[LISTR,,.QORLS]	;SET QUEUE REQUEST TO LIST
	MOVEM	T1,Q.OPR(Q)	; ..
	MOVE	T2,S.LIST	;GET LISTING TYPE
	CAIE	T2,LISTCHECK	;DOES HE WANT A LIST OF HIS JOBS?
	JRST	LISTL1		;NO, CONTINUE

IFN FTUUOS,<
	GETPPN	T1,		;GET PPN INTO T1
	  JFCL			;IGNORE THIS
	SETOM	.FXDIM(I)	;SET THE MASK
>  ;END IFN FTUUOS
IFN FTJSYS,<
	GJINF			;GET JOB INFO
	MOVEI	T2,-1		;GET A MASK
	MOVEM	T2,.FXDIM(I)	;AND SET IT
>  ;END IFN FTJSYS
	MOVEM	T1,.FXDIR(I)	;SAVE IT
LISTL1:	HLLZ	T1,.FXDEV(I)	;SETUP REQUESTED QUEUE
	CAMN	T1,QUENMA	;SEE IF ALLXXX:
	MOVEI	T1,0		;YES--SET TO NULL FOR QMANGR
	MOVEM	T1,Q.DEV(Q)	; ..
	CAME	T1,ONEQUE	;OR DIFFERENT FROM LAST ONE
	SETZM	ONEQUE		;YES--INDICATE MULT QUEUES
	MOVE	T1,.FXDEV(I)	;GET DEVICE
	HRRZM	T1,LSTA		;SAVE FOR LISTER
	HRLZI	T1,Q.ILEN	;SETUP POINTER
	HRRI	T1,(Q)		; FOR QMANGR
	MOVEM	F,SAVEF		;SAVE FLAGS FOR LISTR
	MOVEM	I,SAVEI		;SAVE INDEX FOR LISTR
	MOVEM	Q,SAVEQ		;SAVE QUEUE POINTER FOR LISTR
	PUSHJ	P,.QUEER##	;GO OFF TO QMANGR
	ADDI	I,I.LZER	;ADVANCE TO NEXT REQUEST
	JRST	LISTL		;LOOP BACK TO PROCESS
;HERE AT END OF QUEUE LISTING

LISTE:	PUSHJ	P,LCRLF		;TYPE A CRLF
	SKIPN	LISPDF		;NO * TYPED?
	JRST	LISTE0		;YES--DO NOT INCLUDE FOOTNOTE
	MOVEI	M,[ASCIZ /* Job being output now
/]
	PUSHJ	P,LSTR		;LIST THAT MESSAGE
LISTE0:	SKIPN	LISWFS		;NO # TYPED?
	JRST	LISTE1		;YES--DO NOT INCLUDE FOOTNOTE
	MOVEI	M,[ASCIZ /# Job waiting for file-str to be mounted
/]
	PUSHJ	P,LSTR		;AND TYPE IT
LISTE1:	MOVEI	M,[ASCIZ /The queues are empty
/]
	SKIPE	ONEQUE		;SEE IF ALL:
	MOVEI	M,[ASCIZ /The queue is empty
/]
	SKIPN	LSTANY		;ANYTHING IN THE QUEUES?
	JRST	[PUSHJ P,LSTR	;NO--LIST THE LINE
		 JRST  LISTEX]	; AND CLOSE THE FILE.
	MOVE	T2,S.LIST	;GET LIST MODE
	CAIN	T2,LISTFAST	;FAST MODE?
	JRST	LISTEX		;YES--ALL DONE.
	MOVEI	M,[ASCIZ /
TOTALS:/]
	SKIPE	ONEQUE		;SEE IF ALL:
	MOVEI	M,[ASCIZ /
TOTAL:/]
	SKIPN	LSTTJL		;ANY JOBS AT ALL LISTED?
	MOVEI	M,[ASCIZ /
No jobs match specification
/]
	PUSHJ	P,LSTR		;LIST THAT STUFF
	MOVSI	J,-NUMQS	;MAKE A AOBJN POINTER

;LOOP TO LIST TOTALS

LISTE2:	MOVE	T1,LSJOBN(J)	;GET THE NUMBER OF JOBS
	JUMPLE	T1,LISTE3	;JUMP IF QUEUE EMPTY
	MOVEI	C,.CHTAB	;LOAD A TAB
	PUSHJ	P,LCHR		;AND LIST IT
	MOVE	T2,QUENMT(J)	;GET THE NAME OF THE QUEUE
	PUSHJ	P,LSIXN		;LIST THE NAME
	MOVEI	C,":"		;GET A BREAK
	PUSHJ	P,LCHR		;AND LIST THAT
	PUSHJ	P,LSPC		;LIST A SPACE
	MOVE	T1,LSJOBN(J)	;GET THE NUMBER OF JOBS IN THE QUEUE
	PUSHJ	P,LDEC3		; AND TELL THE USER HOW MANY EXIST.
	MOVEI	M,[ASCIZ / job/] ;TELL THE USER THE UNITS
	PUSHJ	P,LSTR		;OF THE LAST NUMBER
	MOVEI	C,"s"		;LOAD AN S
	SOSE	LSJOBN(J)	;ONLY 1 JOB?
	PUSHJ	P,LCHR		;NO--ADD THE S
	MOVEI	M,[ASCIZ /;  /]	;SEPERATE THE TWO PARTS
	PUSHJ	P,LSTR		; ..
	MOVE	T1,LSTOTL(J)	;GET THE TOTAL UNITS
	XCT	LSTXCT(J)	;LIST IN CORRECT FORMAT
	PUSHJ	P,LSPC		;PUT IN A SPACE
	MOVE	M,LSTLIM(J)	;GET THE UNITS
	SOSN	LSTOTL(J)	;SEE IF JUST ONE
	MOVE	M,LSTLIS(J)	;YES--USE SINGLE WORD
	PUSHJ	P,LSTR		;TYPE THEM OUT
	PUSHJ	P,LCRLF		;LIST A CRLF
LISTE3:	AOBJN	J,LISTE2	;LOOP FOR ALL THAT EXIST

LISTEX:	CLOSE	LC,		;CLOSE OUTPUT
	STATZ	LC,IO.ERR	;CHECK FOR ERRORS
	PUSHJ	P,LCHRWR	;YES--GO ISSUE MESSAGE
	RELEASE	LC,		;RELEASE DEVICE
	POPJ	P,		;AND RETURN
;HERE FROM QMANGR TO LIST EACH ENTRY IN QUEUE
;MUST PRESERVE ALL ACS EXCEPT T1-4
;ENTRY IS IN Q.XXX AREA

			;SWITCH TO LOW SEGMENT
	SWSEG

LISTR:	PUSH	P,M		;% ..
	PUSH	P,C		;% ..
	PUSH	P,I		;% ..
	PUSH	P,J		;% ..
	PUSH	P,Q		;% ..
	PUSH	P,F		;% ..
	PUSH	P,P1		;% ..
	MOVE	I,SAVEI		;%RESTORE INDEX TO INPUT REQUEST
	MOVE	Q,SAVEQ		;%RESTORE POINTER TO QUEUE AREA
	MOVE	F,SAVEF		;%RESTORE FLAGS
	MOVE	P1,S.LIST	;%GET LISTING TYPE

	PUSHJ	P,LISTRC	;%GO SEE IF LISTABLE AND LIST IT

	POP	P,P1		;%RESTORE ACS
	POP	P,F		;% ..
	POP	P,Q		;% ..
	POP	P,J		;% ..
	POP	P,I		;% ..
	POP	P,C		;% ..
	POP	P,M		;% ..
	POPJ	P,		;%RETURN TO QMANGR FOR NEXT ENTRY
;HERE FROM ABOVE WHAN ACS ARE SETUP AND PRESERVED

LISTRC:	SKIPE	T1,LSTA		;%SEE IF SPECIAL QUEUE
	HRRZ	T1,Q.DEV(Q)	;%YES--GET QUEUE
	CAME	T1,LSTA		;% AND COMPARE FOR MATCH
	POPJ	P,		;%REJECT UNSUITABLE ONES
	SETOM	LSTANY		;%FLAG THE QUEUE IS NOT EMPTY
	LDB	T1,[POINT 12,Q.DEV(Q),11] ;%GET FIRST 2 CHARS OF DEVICE
	CAIE	T1,'LL'		;%IS LL
	CAIN	T1,'LU'		;% OR LU?
	MOVEI	T1,'LP'		;%YES, USE LP
	MOVSI	J,-NUMQS	;%MAKE AN AOBJN POINTER
	CAME	T1,LSTNMS(J)	;%IS THIS THE DESIRED QUEUE?
	AOBJN	J,.-1		;%NO--KEEP LOOKING
	JUMPGE	J,LPOPJ		;%GIVE UP IF ILLEGAL QUEUE
	HRRZ	J,J		;%GET RID OF -VE LEFT HALF
	MOVE	T1,.FXNAM(I)	;%CHECK TO SEE IF WE WANT TO LIST THIS
	XOR	T1,Q.JOB(Q)	;% JOB
	MOVE	T2,.FXDIR(I)	;% ..
	XOR	T2,Q.PPN(Q)	;% ..
	TDNN	T1,.FXNMM(I)	;% ..
	TDNE	T2,.FXDIM(I)	;% ..
	POPJ	P,		;%NOT A MATCH--RETURN
	SKIPLE	T1,S.SEQ	;%SEE IF /SEQUENCE
	CAMN	T1,Q.SEQ(Q)	;%YES--TEST THIS ENTRY
	SKIPA			;%OK
	POPJ	P,		;%FAIL--GIVE UP
	HRRZ	T1,Q.ILIM(Q)	;%ASSUME INP:
	SKIPE	J		;%ARE WE RIGHT?
	HLRZ	T1,Q.OSIZ(Q)	;%NO--GET OUTPUT LIMIT
	ADDM	T1,LSTOTL(J)	;%ADD IN TO TOTAL
	AOS	LSJOBN(J)	;%COUNT AS A JOB
	AOS	LSTTJL		;%ONE MORE LISTED
	CAIN	P1,LISTSUM	;%/LIST:SUMMARY?
	POPJ	P,		;%YES, JUST RETURN
	SETOM	LSTSTR		;%ASSUME THERE IS A STRUCTURE
IFN FTUUOS,<
	MOVE	T1,Q.MEM(Q)	;%GET THE STRUCTURE
	MOVEM	T1,LDEV.A	;%STORE IN DSKCHR BLOCK
	MOVE	T1,[5,,LDEV.A]	;%POINT TO ARG BLOCK
	DSKCHR	T1,UU.PHY	;%DO THE DSKCHR
	  SETZM	LSTSTR		;%FAILED, OFF-LINE
	LDB	T2,[POINTR(T1,DC.TYP)]	;%GET TYPE OF ARGUMENT
	CAIN	T2,.DCTDS	;%WAS IT A FILE-STRUCTURE?
	SETZM	LSTSTR		;%NO, SO ITS NOT ON-LINE
	TXNE	T1,DC.OFL!DC.SAF!DC.NNA
				;%CHECK FOR "NOT"
				; OFFLINE - SINGLE ACCESS - NO NEW ACCESS
	SETZM	LSTSTR		;%NOT THERE!!
>  ;END IFN FTUUOS

IFN FTJSYS,<
	MOVE	T1,[POINT 6,Q.MEM(Q)]
	MOVE	T2,[POINT 7,LDEV.B]
	SETZM	LDEV.B		;%CLEAR FIRST WORD OF STR NAME
	SETZM	LDEV.B+1	;%AND SECOND WORD
LISTR1:	ILDB	T3,T1		;%GET A CHARACTER
	JUMPE	T3,LISTR2	;%NULL MEANS DONE
	ADDI	T3,"A"-'A'	;%CONVERT TO ASCII
	IDPB	T3,T2		;%STORE IT
	TLNE	T1,770000	;%DONE 6 YET?
	JRST	LISTR1		;%NO, LOOP
LISTR2:	HRROI	T1,LDEV.B	;%POINT TO STRUCTURE NAME
	MOVEM	T1,LDEV.A	;%STORE IT
	MOVE	T1,[5,,.MSGSS]	;%GET LEN,,FUNC
	MOVEI	T2,LDEV.A	;%POINT TO BLOCK
	MSTR			;%GET STRUCTURE STATUS
	ERJMP	.+3		;%SET FLAG IF FAILED
	MOVE	T1,LDEV.A+1	;%GET THE STATUS
	TXNE	T1,MS%DIS	;%IS IT BEING DISMOUNTED?
	SETZM	LSTSTR		;%FLAG NO STRUCTURE
>  ;END IFN FTJSYS
	JUMPN	J,LISOUT	;%JUMP IF OUTPUT QUEUE
	JRST	LISTIN		;%GO DO THE INPUT QUEUE

LDEV.A:	BLOCK	5		;%BLOCK FOR DSKCHR AND MSTR
LDEV.B:	BLOCK	2		;%BLOCK FOR ASCII STR NAME
;HERE TO LIST AN INPUT QUEUE ENTRY

LISTIN:	CAIN	P1,LISTFAST	;%FAST MODE?
	JRST	LISNIT		;%YES--THEN NO TITLE
	MOVEI	M,INPTTL	;%YES, USE OTHER TITLE LINE
	SKIPN	LSITTF		;%TITLE PRINTED?
	PUSHJ	P,LSTR		;%NO--GO PRINT
	SETOM	LSITTF		;%IT IS NOW
LISNIT:	SETZ	T2,		;%START WITH BLANK
	MOVEI	T3,3		;%3 CHARS
	SKIPE	Q.PDEV(Q)	;%ANY PROCESSING DEVICE?
	MOVSI	T2,'RUN'	;%YES, IT'S RUNNING
	SKIPE	Q.AFTR(Q)	;%AN AFTER PARAMETER?
	MOVSI	T2,'AFT'	;%GIVE AFTER STATUS
	SKIPN	LSTSTR		;%DOES STRUCTURE EXIST?
	MOVSI	T2,'STR'	;%NO, FLAG AS WAITING
	HRRZ	T1,Q.IDEP(Q)	;%GET DEP PARAMETER
	SKIPE	T1		;%ANY DEPEND?
	MOVSI	T2,'DEP'	;%YES, MARK IT
	CAIN	P1,LISTFAST	;%SKIP IF NOT FAST MODE
	JRST	[MOVEI T3,7	;%SIX CHARACTERS AND A SPACE
		 HLRZS  T2	;%GET 0,,STATUS
		 HRLI  T2,'IN ' ;%ADD THE "IN "
		 JRST  .+1]	;%AND CONTINUE
	PUSHJ	P,LSIXC		;%GO LIST			[1205]
	PUSHJ	P,LISTSD	;%LIST THE COMMON PART
	HRRZ	T1,Q.ILIM(Q)	;%GET THE RUN TIME
	PUSHJ	P,LTIME		;%LIST AS HH:MM:SS
	PUSHJ	P,LSPC		;%FOLLOWED BY 1 SPACE
IFN INPCOR,<
	HLRZ	T1,Q.ILIM(Q)	;%GET THE CORE
	ADDI	T1,1777		;%ROUND UP
	LSH	T1,-12		;%CONVERT FROM WORDS TO K
	PUSHJ	P,LDEC3		;%LIST THE CORE
	PUSHJ	P,LSPC		;%GIVE A SPACE
>  ;END IFN INPCOR
	PUSHJ	P,LSPC		;%GIVE ANOTHER ONE
	PUSHJ	P,LSTUSR	;%LIST THE USER NAME
	CAIN	P1,LISTFAST	;%SKIP IF NOT FAST MODE
	PJRST	LCRLF		;%ELSE GIVE A CRLF AND RETURN

	SETO	T4,		;%CRLF FLAG
	HRRE	T1,Q.IDEP(Q)	;%GET DEPENDENCY
	JUMPE	T1,LISSTR	;%DONE IF ZERO
	AOSN	T4		;%NEED A CRLF?
	PUSHJ	P,LCRLF		;%GIVE A CRLF
	MOVEI	M,[ASCIZ /	Dep=/]
	PUSHJ	P,LSTR		;%LIST THE HEADER
	PUSHJ	P,LDEC		;%LIST THE DECIMAL SWITCH
	JRST	LISSTR		;%AND LIST STRUCTURE IF NECESSARY
;HERE TO LIST AN OUTPUT QUEUE

LISOUT:	CAIN	P1,LISTFAST	;%SKIP IF NO FAST LIST
	JRST	LISNOT		;%SLOW LIST GIVE OUTPUT TITLES
	MOVEI	M,OUTTTL	;%POINT TO TITLE
	SKIPN	LSOTTF		;%SKIP IF TITLE GIVEN
	PUSHJ	P,LSTR		;%NO--GIVE THE TITLE
	SETOM	LSOTTF		;%FLAG AS GIVEN
LISNOT:	SKIPN	T2,Q.PDEV(Q)	;%SKIP IF "ON DEVICE"
	JRST	LRMTDV		;%NO--LIST THE QUEUE NAME
	MOVEI	T3,6		;%YES--WE WANT ALL 6 CHARS
	PUSHJ	P,LSIXC		;%LIST THEM			[1205]
	MOVEI	C,"*"		;%GIVE A FOOTNOTE
	PUSHJ	P,LCHR		;% ..
	SETOM	LISPDF		;%FLAG FOOTNOTE NEEDED
LISTOS:	PUSHJ	P,LISTSD	;%LIST THE STANDARD STUFF
	HLRZ	T1,Q.OSIZ(Q)	;%GET THE LIMIT
	PUSHJ	P,LDEC5		;%LIST IT OUT
	PUSHJ	P,LSPC2		;%ADD A SPACE
	PUSHJ	P,LSTUSR	;%LIST THE USER NAME
	CAIN	P1,LISTFAST	;%FAST MODE?
	PJRST	LCRLF		;%YES--NO SECOND LINE EVER
	SETO	T4,		;%SET CRLF FLAG
	SKIPN	T2,Q.OFRM(Q)	;%ANY FORMS SWITCH
	JRST	LISTNT		;%NO--LOOK FOR NOTE
	AOSN	T4		;%YES, NEED A CRLF?
	PUSHJ	P,LCRLF		;%YES, TYPE IT
	MOVEI	M,[ASCIZ /	FORMS=/]
	PUSHJ	P,LSTR		;%LIST HEADER
	PUSHJ	P,LSIXN		;%LIST FORMS
LISTNT:	SKIPN	T2,Q.ONOT(Q)	;%ANY NOTE SWITCH?
	JRST	LISSTR		;%NO--DONE, CHECK FOR STR
	AOSN	T4		;%YES NEED A CRLF
	PUSHJ	P,LCRLF		;%YES TYPE ONE
	MOVEI	M,[ASCIZ /	NOTE=/]
	PUSHJ	P,LSTR		;%YES--GIVE TITLE
	MOVEI	T3,6		;%FORCE 6 CHARS
	PUSHJ	P,LSIXC		;%AND LIST FIRST WORD
	MOVE	T2,Q.ONOT+1(Q)	;%GET SECOND WORD AND LIST THAT
	PUSHJ	P,LSIXN		;% ..

LISSTR:	CAIE	P1,LISTALL	;%/LIST:ALL?
	PJRST	LCRLF		;%NO, RETURN
	AOSN	T4		;%NEED A CRLF?
	PUSHJ	P,LCRLF		;%YES, TYPE ONE
	MOVEI	M,[ASCIZ /	STR=/]
	PUSHJ	P,LSTR		;%TYPE IT
	MOVE	T2,Q.MEM(Q)	;%GET THE STRUCTURE
	PUSHJ	P,LSIX		;%TYPE IT
	PJRST	LCRLF		;%A CRLF AND RETURN
;SUBROUTINE TO LIST AFTER SWITCH

LISTAP:	SKIPN	T1,Q.AFTR(Q)	;%ANYTHING?
LPOPJ:	POPJ	P,		;%NO--RETURN
	SUB	T1,NOW		;%SEE IF IT HAPPENED YET
	JUMPLE	T1,LPOPJ	;%YES--RETURN WITH NOTHING DONE
	PUSHJ	P,LSPC2		;%PRINT 2 SPACES
	MOVEI	M,[ASCIZ /After:/]
	CAIE	P1,LISTFAST	;%DONT PRINT EXTRA STUFF IF /FAST
	PUSHJ	P,LSTR		;%PRINT A STRING
	MOVEI	C,"+"		;%LIST A PLUS SIGN
	HLRZ	T2,T1		;%GET NUM DAYS
	CAIGE	T2,^D100	;%COMPRESS IF 3 DIGITS
	PUSHJ	P,LCHR		;% SO IT LOOKS LIKE TIME FROM NOW
	TRO	F,R.NSEC	;%SUPPRESS SECONDS
	PJRST	LQTIME		;%AND LIST THE TIME IS QUEUE FORMAT

;ROUTINE TO LIST A DEVICE NAME

LRMTDV:	MOVE	T2,Q.DEV(Q)	;%GET THE DEVICE NAME
	MOVEI	T3,6		;%AND THE NUMBER OF CHARACTERS
	PUSHJ	P,LSIXC		;%AND TYPE THEM
	MOVEI	C," "		;%LOAD A SPACE
	SKIPN	LSTSTR		;%DOES STRUCTURE EXIST?
	MOVEI	C,"#"		;%NO, FLAG IT
	CAIN	C,"#"		;%CHECK AGAIN
	SETOM	LISWFS		;%SET FOOTNOTE FLAG

LRMSPC:	PUSHJ	P,LCHR		;%TYPE THE CHARACTER
	JRST	LISTOS		;%AND FINISH OFF THE LINE
;SUBROUTINE TO LIST THE STANDARD PART

LISTSD:	PUSHJ	P,LSPC		;%PUT OUT A SPACE
	MOVE	T2,Q.JOB(Q)	;%GET JOB NAME
	MOVEI	T3,6		;%PRINT SIX CHARS
	PUSHJ	P,LSIXC		;%LIST A SIX SIXBIT LETTERS
	PUSHJ	P,LSPC		;%GIVE A SPACE
	MOVE	T1,Q.SEQ(Q)	;%GET THE SEQ. #
	PUSHJ	P,LDEC5		;%LIST IN 5 CHARS
	PUSHJ	P,LSPC2		;%GIVE 2 SPACES
	MOVE	T1,Q.PRI(Q)	;%GET PRIO WORD
	ANDI	T1,77B35	;%MASK OUT JUNK
	CAIE	P1,LISTFAST	;%DONT PRINT PRIO ON /FAST
	PUSHJ	P,LDEC2		;%LIST AS 2 DIGITS
	PJRST	LSPC2		;%AND TWO MORE SPACES

IFN FTUUOS,<
LSTUSR:	CAIN	P1,LISTFAST	;%/FAST?
	JRST	LSTU.1		;%YES, JUST PPN, NO NAME
	MOVEI	T3,6		;%PRINT ALL 6 CHARS OF
	MOVE	T2,Q.USER(Q)	;% FIRST NAME
	PUSHJ	P,LSIXC		;% ..
	MOVE	T2,Q.USER+1(Q)	;% ..
	PUSHJ	P,LSIX		;%AND AS MUCH AS NECESSARY ON 2ND NAME
	PUSHJ	P,LSPC		;%PUT OUT A SPACE
LSTU.1:	MOVEI	C,"["		;%GET OPEN BRACKET
	PUSHJ	P,LCHR		;%PRINT IT
	HLRZ	T1,Q.PPN(Q)	;%GET THE PROJECT NUMBER
	PUSHJ	P,LOCT		;%PRINT IT
	MOVEI	C,","		;%LOAD A COMMA
	PUSHJ	P,LCHR		;%PRINT IT
	HRRZ	T1,Q.PPN(Q)	;GET PROG NUMBER
	PUSHJ	P,LOCT		;PRINT IT
	MOVEI	C,"]"		;GET A CLOSE BRACKET
	PUSHJ	P,LCHR		;PRINT IT
	PJRST	LISTAP		;GIVE AN AFTER PARAMETER
>  ;END IFN FTUUOS

IFN FTJSYS,<
LSTUSR:	SETZM	JSYBLK		;%CLEAR FIRST WORD
	MOVE	T2,Q.PPN(Q)	;%GET USER NUMBER
	HRROI	T1,JSYBLK	;%AND POINT TO BLOCK
	DIRST			;%GET STRING
	ERJMP	LUSR.1		;%JUST GIVE ALL BLANKS
	MOVE	T1,[POINT 7,JSYBLK]
	SETZ	T2,		;%GET BP AND START WITH 0 COUNT

LUSR.1:	ILDB	C,T1		;%GET A CHARACTER
	JUMPE	C,LISTAP	;%RETURN ON NULL (PRINT AFTER PARM)
	PUSHJ	P,LCHR		;%ELSE LIST IT
	AOJA	T2,LUSR.1	;%AND LOOP

JSYBLK:	BLOCK	10		;JSYS BLOCK
>  ;END IFN FTJSYS
;TITLE LINES


OUTTTL:	ASCIZ	/
OUTPUT QUEUES:
 DEV     JOB    SEQ  PRIO LIMIT    USER
------  ------ ----- ---- -----  ---------------
/


IFN INPCOR,<
INPTTL:	ASCIZ	/INPUT QUEUE:
STS  JOB    SEQ  PRIO   TIME   CORE    USER
--- ------ ----- ---- -------- ----  ---------------
/
>  ;END IFN INPCOR

IFE INPCOR,<
INPTTL:	ASCIZ	/INPUT QUEUE:
STS  JOB    SEQ  PRIO   TIME      USER
--- ------ ----- ---- --------  ---------------
/
>  ;END IFE INPCOR
;TABLE OF 2 CHAR QUEUE NAMES RIGHT ADJUSTED

DEFINE QQ(A,B,C,D,E,F,G,H),<
	NUMQS=NUMQS+1
	<SIXBIT /A/>_<-^D24>
>
	NUMQS==0
LSTNMS:	QUEUES



;TEMPS USED BY LISTER

LSTZER:!
LSJOBN:	BLOCK	NUMQS		;NUMBER OF JOBS IN EACH QUEUE
LSTOTL:	BLOCK	NUMQS		;TOTAL LIMIT FOR EACH QUEUE
LSOTTF:	BLOCK	1		;-1 IF OUTPUT TITFE PRINTED ELSE 0
LSITTF:	BLOCK	1		;-1 IF INPUT TITLE PRINTED ELSE 0
LISPDF:	BLOCK	1		;-1 IF A REQUEST WAS FOUND INTERLOCKED
				; IN AN OUTPUT QUEUE
LISWFS:	BLOCK	1		;-1 IF A REQ WAS FOUND WAITING
				; FOR A STR IN AN OUTPUT QUEUE
LSTANY:	BLOCK	1		;-1 IF SOMETHING TYPED ELSE 0
LSTTJL:	BLOCK	1		;TOTAL JOBS LISTED
LSTSTR:	BLOCK	1		;0=JOBS STR NOT MOUNTED
LSTEZR:!
			;SWITCH TO HIGH SEG
	SWSEG


;ERRORS

E.OEFE:	CLOSE	LC,CL.RST!CL.ACS!CL.DLL   ;RESET ENTER
	RELEAS	LC,		;CLEAR CHANNEL
	MOVEI	T1,L.LOOK	;POINT TO LOOKUP BLOCK
	MOVEI	T2,LN$ENT-1	;GIVE LENGTH
	MOVEI	T3,O.ZER	;POINT TO SCAN BLOCK
	PUSHJ	P,E.LKEN##	;ISSUE ERROR MESSAGE
	PJRST	NFMSX1		;GO ABORT JOB

;ROUTINES TO OUTPUT LIMIT
DEFINE	QQ(A,B,C,D,E,F,G,H),<
	PUSHJ	P,E
>
LSTXCT:	QUEUES
;PLURAL UNITS OF LIMIT
DEFINE	QQ(A,B,C,D,E,F,G,H),<
	[ASCIZ	/G/]
>
LSTLIM:	QUEUES

;SINGLE UNITS OF LIMIT
DEFINE	QQ(A,B,C,D,E,F,G,H),<
	[ASCIZ	/F/]
>
LSTLIS:	QUEUES
			;SWITCH TO LOW SEG
	SWSEG
SUBTTL	COMMAND PROCESSING -- CREATE

	SWSEG		;TO HISEG

;HERE TO CREATE A QUEUE ENTRY
MODIFY:				;MODIFY EXISTING OR FUTURE ENTRY
KILL:	SETOM	CREFLG		;KILL OFF EXISTING ENTRY
CREATE:	IORI	I,2B23		;PUT FORMAT VERSION IN
	MOVEM	I,Q.OPR(Q)	;STORE REQUEST CODE
	MOVNI	T1,I.LZER	;COMPUTE START
	ADD	T1,I.NXZR	; OF LAST SPEC
	MOVEM	T1,I.LSZR	; FOR WILD
	MOVE	T1,O.DEV	;DESTINATION DEVICE IS OUTPUT PARAMETER
	MOVEM	T1,Q.DEV(Q)	;STORE IT

IFN FTUUOS,<
	MOVE	T3,O.DIR	;GET SPECIFIED PPN
	MOVEM	T3,Q.PPN(Q)	;STORE INTO REQUEST
>  ;END IFN FTUUOS

IFN FTJSYS,<
	MOVEI	T1,UBLOCK	;LOAD ADDRESS OF /USER BLOCK
	MOVEM	T1,Q.PPN(Q)	;SAVE IT
>  ;END IFN FTJSYS
	SKIPE	T1,O.NAM	;GET PROPOSED JOB NAME
	MOVEM	T1,Q.JOB(Q)	;STORE IT
	MOVE	T1,S.SEQ	;GET SEQUENCE NUMBER
	MOVEM	T1,Q.SEQ(Q)	;PLACE INTO REQUEST
	LDB	T1,[POINTR (O.MOD,FX.PRO)]  ;GET USER SPECIFIED PROTECTION
	CAIE	T1,777		;DID HE SAY /PROT:777?
	JRST	CREA1A		;NO, DON'T CHANGE IT
	N$WARN	<PII>,,</PROTECT:777 is illegal, changed to 677>
	MOVEI	T1,677		;AND DO IT
CREA1A:	SKIPE	T1		;NOT SPECIFIED?
	JRST	CREA2A		;YES IT WAS, USE HIS
	SKIPN	CREFLG		;NOTHING SPECIFIED. IS THIS CREATE?
	JRST	CREA2A		;YES, SEND A 0 AND LET QUASAR DO THE WORK
	MOVEI	T1,777		;ON /MOD USE 777 TO SHOW NO CHANGE
CREA2A:	LSH	T1,^D9		;POSITION
	MOVE	T2,S.PRI	;GET EXTERNAL PRIORITY
	ANDI	T2,77		;MASK TO FIT
	IOR	T1,T2		;COMBINE RESULTS
	MOVEM	T1,Q.PRI(Q)	;STORE
	SKIPN	CREFLG		;SEE IF /CREATE
	JRST	CREAT2		;YES--SKIP WILD CARDS
	MOVE	T1,O.DIRM	;GET DIRECTORY WILDCARD
	MOVEM	T1,Q.TIME(Q)	;STORE FOR QMANGR
	MOVE	T1,O.NAMM	;GET JOB NAME WILDCARD
	MOVEM	T1,Q.CREA(Q)	;STORE
CREAT2:	MOVE	T1,S.AFT	;GET AFTER SWITCH
	MOVEM	T1,Q.AFTR(Q)	;STORE IN REQUEST
	MOVE	T1,S.DED	;GET DEADLINE SWITCH
	MOVEM	T1,Q.DEAD(Q)	;STORE IN REQUEST

IFN FTUUOS,<
	MOVE	T1,Q.PPN(Q)	;SEE IF REQEST IS FOR ME
	CAME	T1,.MYPPN##	; ..
	JUMPN	T1,CREUSR	;NO, LEAVE USER NAME BLANK UNLESS DEFAULT
	DMOVE	T1,G$NAM1	;GET USER NAME
	DMOVEM	T1,Q.USER(Q)	; ..
>  ;END IFN FTUUOS

CREUSR:	MOVE	T1,QTYPE	;SEE WHICH QUEUE WAS REQUESTED
	CAIN	T1,QTPINP	;WAS IT INPUT?
	JRST	CREI		;YES--GO PROCESS IT

	MOVE	T1,S.FRM	;GET SPECIAL FORMS REQUEST
	MOVEM	T1,Q.OFRM(Q)	;STORE INTO OUTPUT HEADER
	SETZB	T1,LOGCNT	;SET LOG FILE COUNTER SO NEVER FOUND
	HRROM	T1,Q.OSIZ(Q)	;CLEAR SIZE OF REQUEST, NO LIMIT YET
	DMOVE	T1,S.NOT	;GET ANNOTATION
	DMOVEM	T1,Q.ONOT(Q)	;AND SAVE IT
	MOVEI	J,Q.FF(Q)	;J=START OF OUTPUT QUEUE REQUEST AREA
	MOVSI	T1,(BYTE (9)Q.FF-Q.ZER-1,Q.FLEN(18)0)
	JRST	CREOLP		;GO LOOP OVER REQUEST
;HERE TO SETUP INP REQUEST

CREI:	HRRZ	T1,S.DPN	;GET DEPENDENCY REQUEST
	SKIPN	CREFLG		;SEE IF /MOD OR /KILL
	TRZ	T1,3B19		;NO--CLEAR +- FLAGS
	SKIPN	S.RSTR		;SEE IF /REST:1
	TLO	T1,(1B0)	;YES--SET /REST:1
	SKIPE	CREFLG		;SEE IF /MOD
	SKIPGE	S.RSTR		;YES--SEE IF /REST
	JRST	.+2		;NO--PROCEED
	TLO	T1,(1B3)	;YES--SET CHANGE FLAG
	MOVE	T2,S.UNIQ	;GET UNIQUENESS
	ADDI	T2,1		;SET TO INTERNAL VALUE
	DPB	T2,[POINT 2,T1,2]  ;STORE IN REQUEST
	MOVE	T2,S.OUT	;GET OUTPUT QUEUEING
	DPB	T2,[POINT 3,T1,8]  ;STORE
	MOVEM	T1,Q.IDEP(Q)	;STORE INTO QUEUE REQUEST
	MOVSI	T3,-.FXLND	;SET FOR FULL LOOP COUNT
	HRRI	T3,(Q)		;POINT TO REQUEST
	MOVEI	T2,0		;INITIALIZE FETCH POINTER
CREIDD:	SKIPE	T1,DEFDIR(T2)	;GET /PATH:
	ADDI	T2,2		;ADVANCE FETCH UNLESS AT END
	MOVEM	T1,Q.IDDI(T3)	;STORE IN REQUEST
	AOBJN	T3,CREIDD	;LOOP UNTIL DONE
	HRLZ	T1,S.COR	;FETCH CORE LIMIT
	HRR	T1,S.LTIM	;FETCH CPU TIME LIMIT
	HLRZ	T2,S.LTIM	;GET LEFT HALF OF THE LIMIT
	CAIE	T2,-1		;IF -1
	JUMPN	T2,[HRRI T1,-2	;OR 0, IGNORE IT, ELSE LOAD "INFIN"
		    JRST .+1]	;AND CONTINUE
	MOVEM	T1,Q.ILIM(Q)	;STORE

IFN FTUUOS,<
	HLRZ	T1,T1		;GET /CORE VALUE
	MOVE	T2,G$CMAX	;GET SYSTEM CORMAX
	JUMPE	T2,CREI1	;FORGET IT IF ZERO
	JUMPE	T1,CREI2	;IF 0, IGNORE IT
	CAIN	T1,-1		;OR IF UNCHANGED,
	JRST	CREI1		;IGNORE IT
	CAMG	T1,T2		;SEE IF /CORE IS .GT.
	JRST	CREI1		;NO--PROCEED
	PUSH	P,T2		;SAVE CORMAX
	N$WARN	<CLG>,<N>,<Core limit of>
	HLRZ	T1,Q.ILIM(Q)	;GET LIMIT BACK
	PUSHJ	P,.TCORW##	;TYPE IT
	MOVEI	T1,[ASCIZ / is greater than cormax of /]
	PUSHJ	P,.TSTRG	;MORE MESSAGE
	POP	P,T1		;RESTORE CORMAX
	PUSHJ	P,.TCORW##	;TYPE IT
	PUSHJ	P,.TCRLF##	;TYPE A CRLF
	JRST	CREI2		;SKIP MINMAX CHECK, HE'S OBVIOUSLY GREATER
CREI1:	MOVE	T2,G$MNMX	;GET MINMAX
	JUMPE	T2,CREI2	;IGNORE IF ZERO
	CAIN	T1,-1		;IF UNCHANGED,
	JRST	CREI2		;IGNORE IT
	CAML	T1,T2		;IS /CORE LT MINMAX?
	JRST	CREI2		;NO, OK
	PUSH	P,T2		;SAVE MINMAX
	N$WARN	<CLR>,<N>,<Core limit of>
	HLRZ	T1,Q.ILIM(Q)	;GET /CORE BACK
	PUSHJ	P,.TCORW##	;AND TYPE IT
	MOVEI	T1,[ASCIZ / raised to minimum of /]
	PUSHJ	P,.TSTRG##	;TYPE IT
	POP	P,T1		;RESTORE CORMIN
	PUSHJ	P,.TCORW##	;TYPE IT
	PUSHJ	P,.TCRLF##	;AND A CRLF
>  ;END IFN FTUUOS FROM PREVIOUS PAGE

CREI2:	HRLZ	T1,S.LLPT	;FETCH PAGE LIMIT
	HRR	T1,S.LCDP	;FETCH CARD PUNCH LIMIT
	MOVEM	T1,Q.ILIM+1(Q)	;STORE
	HRLZ	T1,S.LPTP	;FETCH PAPER TAPE LIMIT
	HRR	T1,S.LPLT	;FETCH PLOT LIMIT
	MOVEM	T1,Q.ILIM+2(Q)	;STORE
	MOVEI	T1,2		;SET LOG FILE COUNTER
	MOVEM	T1,LOGCNT	; TO MATCH ON SECOND REQUEST
	MOVEI	J,Q.II(Q)	;J=START OF INPUT FILE AREA
	MOVSI	T1,(BYTE (9)Q.II-Q.ZER-1,Q.FLEN(18)0)
;HERE TO LOOP OVER EACH FILE TO BE QUEUEED AND PREPARE IT

CREOLP:	MOVEI	T2,Q.FLNM	;GET MODIFY PER FILE LENGTH
	SKIPE	CREFLG		;SEE IF CREATE
	DPB	T2,[POINT 9,T1,17]  ;NO--CHANGE LENGTH
	MOVEM	T1,Q.LEN(Q)	;SET PREFIX OF LENGTHS
	MOVEM	J,.JBFF		;RESET .JBFF TO START OF FILE AREA
	SUBI	J,Q.FLEN	;BACK UP TO START RIGHT
	SKIPE	CREFLG		;SEE IF /CREATE
	SUBI	J,Q.FLNM-Q.FLEN ;NO--BACK UP POINTER SOME MORE
	MOVEI	I,0		;I=START OF NEXT REQUEST AREA
CREOFL:	MOVEI	T1,Q.FLEN	;GET CREATE PER FILE LENGTH
	SKIPE	CREFLG		;SEE IF CREATE
	MOVEI	T1,Q.FLNM	;NO--GET MODIFY PER FILE LENGTH
	ADD	J,T1		;ADVANCE POINTER
	PUSHJ	P,GCORE.	;GET ENOUGH CORE
	SOS	LOGCNT		;ADVANCE LOG FILE COUNTER
	SETZM	(J)		;CLEAR NEW AREA
	HRLZI	T1,(J)		; ..
	HRRI	T1,1(J)		; ..
	BLT	T1,Q.FLEN(J)	; ..
	SKIPE	CREFLG		;SEE IF /CREATE
	JRST	CREOMD		;NO--GO BELOW FOR REST OF /MODIFY
	SKIPN	LOGCNT		;IS THIS THE LOG FILE?
	TXO	F,R.ANUL	;YES, ALLOW NUL:
	PUSHJ	P,LOOKFL	;LOOK FOR NEXT FILE
	  JRST	CREODN		;IF NO MORE FILES
	JRST	CREONS		;ELSE CONTINUE

;HERE ON /MODIFY SWITCH

CREOMD:	BLT	T1,Q.FLNM(J)	;CLEAR REST OF AREA
	PUSHJ	P,GETMOD	;GET MODIFY REQUEST PARAMETERS
	  JRST	CREODN		;ALL DONE
	JRST	CREONT

CREONS:	RELEAS	DC,		;RELEASE THE CHANNEL
	CLOSE	DC,CL.NMB	;KEEP ACCESS TABLE IN CORE
CREONT:	AOS	Q.LEN(Q)	;COUNT OUTPUT FILE
	JRST	CREOFL		;LOOP BACK FOR NEXT FILE
CREODN:	MOVE	I,QTYPE		;SAVE FOR EASE OF TESTS
	JUMPE	I,CREOGI	;IF INPUT, SKIP SIZE STORE
	SKIPLE	T1,S.LIM	;IS IT A REASONABLE LIMIT
	JRST	CRELIM		;YES, CONTINUE ON
	SETZ	T1,		;NO, INSURE ZERO
	SKIPN	CREFLG		;IS THIS CREATE?
	JRST	CRELIM		;YES, ALL IS WELL
	HRROS	Q.OSIZ(Q)	;ELSE SET MODIFY MASK TO NO CHANGE
	JRST	CRESIZ		;AND CONTINUE ON
CRELIM:	CAILE	T1,777776	;CHECK TO LARGE
	MOVEI	T1,777776	;FORCE OK
	HRLOM	T1,Q.OSIZ(Q)	;SAVE FOR SCHEDULING
CRESIZ:	SKIPE	CREFLG		;SEE IF /CREATE
	JRST	CREOGG		;NO--GO ON
	MOVE	T2,NOBLKS	;GET COUNT OF BLOCKS QUEUED
	CAILE	T2,777777	;HANDLE OVERFLOW
	MOVEI	T2,777777	;YES--MAKE MAXIMUM
	HRRM	T2,Q.OSIZ(Q)	;REMEMBER FOR SCHEDULING
	JRST	CREOGG		;GO CONTINUE OUTPUT

CREOGI:	SKIPE	CREFLG		;SEE IF /CREATE
	JRST	CREOGG		;NO--PROCEED
	HRROI	T2,Q.FSTR-Q.FLEN	;NO--USE A DIFFERENT DISTANCE
	ADDI	T2,(J)		;FIX T2 TO POINT TO STR OF LOG
	SKIPE	T1,(T2)		;SEE IF LOG FILE EXISTS YET
	CAMN	T1,[SIXBIT /DSK/]  ;  IE, IS STRUCTURE KNOWN
IFN FTJSYS,<
	MOVE	T1,CTLSTR	  ;NO--USE CTL FILE STRUCTURE
>  ;END IFN FTJSYS
IFN FTUUOS,<
	MOVE	T1,Q.FSTR+Q.II(Q) ;NO--USE CTL FILE STRUCTURE
>  ;END IFN FTUUOS
	MOVEM	T1,(T2)		;STORE CONCLUSION

CREOGG:	HRRZ	T4,Q.LEN(Q)	;GET NUMBER OF FILES
	SKIPE	CREFLG		;SEE IF /CREATE
	JRST	CREOGH		;NO--JUST GO OUTPUT REQUEST
	JUMPE	T4,E.NFLS	;YES--ERROR IF NO FILES
	CAIE	T4,2		;SEE IF EXACTLY TWO FILES
	SKIPE	QTYPE		;SEE IF IT'S INP:
	SKIPA			;ALL IS WELL
	N$FATE <INF>,,<Incorrect number of files in input queue request>
	LDB	T1,[POINT 9,Q.LEN(Q),8]  ;GET HEADER LENGTH
	ADDI	T1,(Q)		;GET ADDRESS OF FIRST FILE
	MOVE	T1,Q.FNAM+1(T1)	;GET FIRST FILE NAME
	SKIPN	Q.JOB(Q)	;SEE IF JOB HAS A NAME YET
	MOVEM	T1,Q.JOB(Q)	;NO--GIVE IT THE FIRST FILE NAME

CREOGH:	SKIPE	S.ALLF		;DOES HE WANT ALL HIS FILES?
	SKIPN	NAFFLG		;YES, DOES HE HAVE THEM ALL?
	  SKIPA			;YES, ALL IS FINE
	N$FATE	<NAF>,,<Not All Requested Files Exist>
	HRRZ	T1,J		;SET POINTER FOR QMANGR
	SUBI	T1,(Q)		; ..
	HRLZI	T1,1(T1)	; ..
	HRRI	T1,(Q)		; ..
	PJRST	.QUEER##	;GO CREATE REQUEST AND RETURN
;ERRORS

E.NFLS:	SKIPLE	S.NULL		;NO FILES--SEE IF MESSAGE SUPPRESSED
	POPJ	P,		;YES--JUST RETURN
	N$FATE	<NFI>,,<No files in request>
SUBTTL	Command Processing Subroutines


;LOOKFL -- ROUTINE TO DO A WILD-CARD LOOKUP
;ENTERRED WITH Q.FXXX ZEROED, INTIALLY WITH NOFILF, ETC. ZEROED.
;CALL:(	MOVEI	I,0	INITIALLY)
;	MOVEI	J,ADDR. OF NEXT RESULT BLOCK
;	PUSHJ	P,LOOKFL
;	  ERROR RETURN IF NO MORE (MESSAGE ISSUED IF APPROPRIATE)
;	SKIP RETURN IF FILE FOUND--4-WORD LOOKUP DONE TO T1-4
;	I WILL BE UPDATED IF NECESSARY TO POINT TO THE NEXT BLOCK
;	MFD, UFD FILES WILL BE POSITIONED FOR NEXT TIME IN.
;	THE Q. FILE LIST AREA WILL BE UPDATED
;USES T1,T2,T3,T4

LOOKFL:!
LOOKFR:	MOVE	T1,[4,,[I.INZR,,I.LSZR
			OPNBLK,,LKBLK
			I.LZER,,LKBLKL
			400000+DC,,I]  ]
	PUSHJ	P,.LKWLD##	;GET NEXT WILD NAME
	  POPJ	P,		;ALL DONE
	JUMPE	T1,[MOVE T1,I.MOD(I)
		    TXNN T1,X.NEW     ;IF NON-EX-DEV, SEE IF /NEW
		    JRST E.NSD	      ;NO SUCH DEVICE
		    MOVSI T1,.FXLEN   ;BLOCK LENGTH
		    HRRI  T1,(I)      ;BLOCK ADDRESS
		    MOVEI T2,OPNBLK   ;OPEN BLOCK
		    MOVE  T3,[LKBLKL,,LKBLK]
		    PUSHJ P,.STOPN##  ;ANY WILD CARDS?
		      JRST   E.WIN
		    MOVE  T1,OPNBLK+1  ;GET ARGUMENT DEVICE
		    MOVEM T1,Q.FSTR(J) ;STORE IT
		    MOVEM T1,RIBDEV    ;AND HERE ALSO
		    MOVE  T1,RIBNAM    ;GET FILENAME
		    MOVEM T1,Q.FNAM(J) ;STORE IN REQUEST
		    MOVE  T1,RIBEXT    ;GET EXTENSION
		    HLLZM T1,Q.FEXT(J) ;STORE IN REQUEST
		    JRST  LOOKND]      ;AND MAKE BELIEVE THE LOOKUP FAILED
	TXNN	T1,DV.DSK	;DOES IT THINK IT'S A DISK?
	JRST	E.NDD		;NO, NOT EVEN CLOSE
	TXNE	T1,DV.TTY	;YES, IF IT THINKS ITS A TTY TOO, IT'S NUL:
	TRZE	F,R.ANUL	;YES, IT'S NUL:, DO WE ALLOW IT?
	JRST	LOOKLK		;YUP, HE'S GOLDEN
	JRST	E.NDD		;NO, LOSE BIG
;HERE WHEN LOOKUP BLOCK PREPARED FOR NEXT FILE
; AND IT IS TIME TO OPEN AND LOOK IT UP

LOOKLK:	MOVE	T1,OPNBLK+1	;GET ARGUMENT DEVICE
	MOVEM	T1,Q.FSTR(J)	;STORE AS STRUCTURE
	MOVE	T1,RIBNAM	;GET FILE NAME
	MOVEM	T1,Q.FNAM(J)	;STORE IN REQUEST
	MOVE	T1,RIBEXT	;GET FILE EXTENSION
	HLLZM	T1,Q.FEXT(J)	;STORE IN REQUEST
	OPEN	DC,OPNBLK	;OPEN CHANNEL
	  JRST	[PUSHJ P,E.DFO##
		 JRST  LOOKFR]

LOOKIE:	MOVEI	T4,PTHFCN	;POINT TO USER PATH
	MOVX	T2,X.LOG	;GET LOG FILE BIT
	TDNE	T2,I.MOD(I)	;TEST THE FILE (IS IT THE LOG?)
	SKIPE	RIBPPN		;YES, IS THERE A PPN SPECIFIED?
	MOVE	T4,RIBPPN	;YES, USE IT
	MOVEM	T4,RIBPPN	;USE THE CORRECT ONE
	LOOKUP	DC,LKBLK	;EXTENDED LOOKUP
	  JRST	LOOKER		;IF FAILURE

IFN FTUUOS,<
	MOVEI	T1,DC		;GET CHANNEL NUMBER
	MOVEM	T1,PTFFCN	;SET IN PATH BLOCK
	MOVE	T1,[.PTMAX,,PTFFCN]
	PATH.	T1,		;GET LOCATION FROM MONITOR
	  SETZM	PTFPPN+1	;CLEAR RESULT
	MOVEI	T1,PTFFCN	;POINT TO BLOCK
	SKIPE	PTFPPN+1	;SEE IF SFDS
	MOVEM	T1,RIBPPN	;YES--POINT FROM LOOKUP
	MOVSI	T4,(7B2)	;GET LEVEL D UNPROTECTED MASK
	MOVX	T3,X.UNP	;PREPARE TO TEST /UNPRESERVED
	TDNE	T3,I.MOD(I)	;TEST
	TDNN	T4,RIBPRV	;YES TO SWITCH--CHECK FILE
	JRST	.+2		;NOT UNPRES. OR DON'T CARE
	JRST	LOOKFR		;PRESERVED--LOOP BACK
>  ;END IFN FTUUOS

	PUSHJ	P,.CHKTM##	;CHECK /BEFORE/SINCE
	  JRST	LOOKFR		;BAD--RECYCLE

	PUSHJ	P,ISBIN		;SEE IF BINARY AND IMPROPER
	  JRST	LOOKBN		;YES--GIVE ERROR
	SKIPE	T4,RIBDEV	;GET UNIT NUMBER
	MOVEM	T4,Q.FSTR(J)	;STORE INTO REQUEST
	MOVE	T4,RIBSIZ	;GET LENGTH IN WORDS
	ADDI	T4,177		;ROUND UP
	ASH	T4,-7		;CONVERT TO BLOCKS
	LDB	T3,[POINTR (I.MOD(I),X.COP)]  ;GET REPEAT COUNT
	SKIPN	T3		;FORCE NON-ZERO
	MOVEI	T3,1		;YES
	IMUL	T3,T4		;COMPUTE COMBINED TOTAL
	ADDM	T3,NOBLKS	;ADD TO ACCUMULATED TOTAL
	MOVX	T3,X.NEW	;GET THE /NEW BIT
	ANDCAM	T3,I.MOD(I)	;AND TURN IT OFF

LOOKND:	SETZM	Q.FDIR(J)	;CLEAR OUT DIRECTORY
	HRLI	T1,Q.FDIR(J)	; ..
	HRRI	T1,Q.FDIR+1(J)	; ..
	BLT	T1,Q.FDIR+.FXLND-1(J) ; ..

IFN FTUUOS,<
	SKIPN	T1,RIBPPN	;GET LOOKUP DIRECTORY
	MOVEI	T1,PTHFCN	;UNKNOWN--GET DEFAULT
	TLNE	T1,-1		;SEE IF SFD
	SKIPA	T2,T1		;NO--GET UFD
	MOVE	T2,.PTPPN(T1)	;YES--GET UFD
	MOVEM	T2,Q.FDIR(J)	;SAVE IN QUEUE REQUEST
	TLNE	T1,-1		;SEE IF SFDS
	JRST	LOOKDD		;NO--DONE WITH DIRECTORY
	MOVEI	T2,Q.FDIR+1(J)	;YES--POINT TO SFDS IN QUEUE REQUEST
	HRLI	T2,1-.FXLND	;COUNT NUMBER OF SFDS
LOOKDL:	SKIPN	T3,.PTPPN+1(T1)	;GET NEXT SFD
	JRST	LOOKDD		;ALL DONE
	MOVEM	T3,(T2)		;STORE IN REQUEST
	AOS	T1		;ADVANCE FETCH
	AOBJN	T2,LOOKDL	;LOOP OVER STORE
>  ;END IFN FTUUOS

IFN FTJSYS,<
	MOVE	T1,RIBPPN	;GET FILE'S PPN
	TLNN	T1,-1		;IS IT A PATH POINTER?
	MOVE	T1,.PTPPN(T1)	;YES, GET THE PPN
	MOVEM	T1,Q.FDIR(J)	;SAVE IT
	SETZM	Q.FDIR+1(J)	;AND CLEAR SFDS
>  ;END IFN FTJSYS
LOOKDD:	MOVE	T3,I.MOD(I)	;GET SWITCHES


IFN FTJSYS,<
	TXNE	T3,X.NEW	;IS /NEW SET?
	JRST	LOOKD1		;YES, DONT DO THIS
	MOVE	T1,QTYPE	;LOAD QUEUE TYPE
	MOVE	T2,LOGCNT	;AND LOG FILE COUNTER
	MOVE	T3,Q.FSTR(J)	;AND THE STRUCTURE
	CAIN	T1,QTPINP	;IS IT THE INPUT QUEUE
	CAIE	T2,1		;AND IS THIS THE CONTROL FILE
	SKIPA			;NO, SKIP
	MOVEM	T3,CTLSTR	;YES, SAVE THE STRUCTURE
	MOVE	T1,[3,,T2]	;ARG POINTER
	MOVE	T2,[DC,,5]	;CHANNEL,,FUNCTION
	MOVE	T3,[POINT 7,Q.FSTR(J)]
	MOVE	T4,[111110,,1]	;JFNS BITS
	COMPT.	T1,		;MAKE A STRING
	  JRST	LOOKBD		;??
	MOVE	T3,I.MOD(I)	;GET SWITCHES BACK
	TXO	T3,X.STG	;SET FLAG FOR QMANGR
>  ;END IFN FTJSYS


LOOKD1:	TXZ	T3,X.UNP!X.OKBN	;CLEAR VARIOUS FLAGS
	MOVEI	T1,FILEASCII	;GET DEFAULT /FILE
	HLRZ	T2,Q.FEXT(J)	;GET THE EXTENSION
	CAIN	T2,'DAT'	;.DAT?
	MOVEI	T1,FILEFORTRAN	;YES, USE /FILE:FORT
	TXNN	T3,X.FILE	;WAS IT ALREADY FILLED IN?
	DPB	T1,[POINTR(T3,X.FILE)] ;NO, FILL IT IN
	MOVEI	T1,DISPPRES	;GET DEFAULT DISPOSITION
	CAIN	T2,'LST'	;IS IT A .LST FILE?
	MOVEI	T1,DISPDELE	;YES, LOAD DEFAULT
	TXNN	T3,X.DISP	;WAS /DISP: ALREADY SET?
	DPB	T1,[POINTR(T3,X.DISP)] ;NO, FILL IT IN
	MOVEM	T3,Q.FMOD(J)	;PUT INTO REQUEST
	MOVE	T3,I.STRT(I)	;GET STARTING POINT
	MOVEM	T3,Q.FBIT(J)	;SAVE IN REQUEST
	SETCM	T3,I.RPT(I)	;SEE IF /REPORT
	JUMPE	T3,.POPJ1	;NO--RETURN
	DMOVE	T3,I.RPT(I)	;GET /REPORT
	DMOVEM	T3,Q.FRPT(J)	;AND SAVE IT
	JRST	.POPJ1		;IF SUCCESS RETURN
;HERE WHEN LOOKUP FAILS--SEE IF .NULL NEEDED OR /NEW SWITCH

LOOKER:	MOVEM	T4,RIBPPN	;RESTORE DIRECTORY
	HRRZ	T2,RIBEXT	;GET LOOKUP ERROR CODE
	JUMPN	T2,LOOKBD	;GO ISSUE ERROR
	HLLZ	T1,RIBEXT	;NOT FOUND--SEE IF NULL APPROPRIATE
	JUMPE	T1,LOOKNF	;IF ALREADY NULL, TRY BELOW
	MOVX	T1,FX.NUL	;NOT NULL--SEE IF NULL NEEDED
	TDNN	T1,.FXMOD(I)	; ..
	JRST	LOOKNF		;NOT NEEDED--HANDLE ERROR
	SETZM	RIBEXT		;CHANGE LOOKUP BLOCK
	SETZM	Q.FEXT(J)	; AND REQUEST
	JRST	LOOKIE		;AND TRY AGAIN

LOOKNF:	MOVE	T3,I.MOD(I)	;GET SWITCHES
	TXNN	T3,X.NEW	;SEE IF /NEW
	JRST	LOOKBD		;NO--ERROR
	SETZM	RIBPRV		;CLEAR PROTECTION, ETC.
	JRST	LOOKND		;AND RETURN RESULTS

LOOKBD:	PUSHJ	P,E.DFL##	;ISSUE ERROR MESSAGE
	SETOM	NAFFLG		;SET A FLAG SAYING A FILE ISN'T THERE
	JRST	LOOKFR		;LOOP BACK TO GET NEXT REQUEST

LOOKBN:	N$WARN	<CPB>,<N>,<Can't print binary>
	PUSHJ	P,.TFILE##
	JRST	LOOKFR		;LOOP FOR NEXT FILE
;ISBIN -- SUBROUTINE TO SEE IF IMPROPERLY TRYING TO PRINT BINARY
;CALL:	PUSHJ	P,ISBIN
;ERROR RETURN IF WRONG
;SKIP RETURN IF OK
;USES T1, T2, T3, T4

ISBIN:	MOVX	T1,X.OKBN	;SEE IF /OKBINARY SWITCH
	TDNE	T1,I.MOD(I)	; ..
	JRST	.POPJ1		;YES--GIVE OK RETURN
	LDB	T1,[POINTR (I.MOD(I),X.PAPR)]  ;GET MODE
	LDB	T2,[POINTR (RIBPRV,RB.MOD)]  ;GET FILE MODE
	CAILE	T2,.IOASL	;IF FILE MODE IS ASCII OR ASCII LINE,
	CAILE	T1,PRINASCII	;OR IF OUTPUT MODE IS NOT ASCII OR ARROW,
	JRST	.POPJ1		;THEN IT IS OK ANYWAY
	MOVE	T1,QTYPE	;GET TYPE OF QUEUE
	CAIE	T1,QTPLPT	;IF NOT LPT,
	JRST	.POPJ1		; THEN IT IS OK

;HERE WHEN NO SPECIAL CASES, JUST LPT OF RANDOM FILE

	HLRZ	T1,RIBEXT	;GET EXTENSION FOR EASE OF TESTING
	MOVSI	T3,-LENBEX	;GET LENGTH OF BINARY EXTENSION TABLE
ISBIN1:	MOVE	T2,BINEXT(T3)	;GET NEXT PAIR
	CAIN	T1,(T2)		;SEE IF IT MATCHES
	POPJ	P,		;YES--ERROR RETURN
	HLRZS	T2		;TRY OTHER ONE
	CAIN	T1,(T2)		;..
	POPJ	P,		;ERROR RETURN
	AOBJN	T3,ISBIN1	;LOOP UNTIL DONE
	JRST	.POPJ1		;NOT BINARY EXTENSION--MUST BE OK

BINEXT:	'BACBIN'	;BASIC OUTPUT,,BINARY
	'BUGCHN'	;PROGRAM SAVED WITH BUG,,CHAIN FILE
	'DAEDCR'	;DAEMON FILE,,DCORE FILE
	'DMPHGH'	;PDP-6 SAVE,,NON-SHAREABLE HIGH SEG SAVE
	'LOWMSB'	;LOW SEGMENT,,MUSIC PROGRAM OUTPUT
	'OVRQUC'	;COBOL OVERLAY,,QUEUE CHANGE
	'QUDQUE'	;QUEUE DATA,,QUEUE REQUEST
	'QUFREL'	;QUEUED REQUEST,,RELOCATABLE BINARY
	'RIMRMT'	;TWO KINDS OF READ IN MODE FILES
	'RTBSAV'	;ANOTHER RIM,,SAVE FILE
	'SFDSHR'	;SUB-FILE DIRECTORY,,SHAREABLE HIGH SEGMENT SAVE
	'SVESYS'	;10/30 SAVE,,SYSTEM BINARY FILE
	'TMPUFD'	;TEMPORARY FILE,,USER'S FILE DIRECTORY
	'XPNVMX'	;EXPANDED SAVE FILE,,VM SPECIAL CORE IMAGE
	'EXEEXE'	;NEW SAVE FILE FORMAT,,**SPARE**

;ADD MORE HERE--FILL WITH A DUPLICATE--NEVER FILL WITH 0
LENBEX==.-BINEXT
;GETMOD -- ROUTINE TO GET NEXT MODIFY FILE SPECIFICATION
;THE RESULT IS PLACED IN THE QUEUE REQUEST
;THIS SERVES THE SAME FUNCTION AS LOOKFL
;CALL:	MOVEI	I,0	INITIALLY
;	MOVEI	J,ADDR. OF NEXT RESULT BLOCK
;	PUSHJ	P,GETMOD
;	  ERROR RETURN IF END OF REQUESTS
;	SKIP RETURN IF FILE COPIED
;USES T1, T2, T3

GETMOD:	SKIPN	I		;SEE IF FIRST CALL
	SKIPA	I,I.INZR	;YES--GET START OF REQUESTS
	ADDI	I,I.LZER	;NO--ADVANCE TO NEXT REQUEST
	CAML	I,I.NXZR	;SEE IF DONE YET
	POPJ	P,		;YES--RETURN

	SKIPN	T1,.FXDEV(I)	;GET USER SUPPLIED NAME
	JRST	GETMDS		;NONE--SKIP BELOW
	MOVX	T2,FX.PHY	;GET /PHYSICAL BIT
	TDNN	T2,.FXMOD(I)	;SEE IF PHYSICAL REQUESTED
	DEVNAM	T1,		;NO--CONVERT LOGICAL TO PHYSICAL DEVICE
	  JFCL			;NICE TRY
GETMDS:	MOVEM	T1,Q.FSTR(J)	;STORE PHYSICAL NAME AWAY
	MOVE	T1,.MYPPN##	;GET LOGGED IN PPN
	MOVSI	T2,-1		;MASK FOR PROJECT
	TDNN	T2,.FXDIR(I)	;SEE IF PROJECT
	HRROS	.FXDIM(I)	;NO--GIVE SELF
	TDNN	T2,.FXDIR(I)	; ..
	HLLM	T1,.FXDIR(I)	; ..
	MOVEI	T2,-1		;MASK FOR PROGRAMMER
	TDNN	T2,.FXDIR(I)	;SEE IF PROGRAMMER
	HLLOS	.FXDIM(I)	;NO--GIVE SELF
	TDNN	T2,.FXDIR(I)	; ..
	HRRM	T1,.FXDIR(I)	; ..
	MOVEI	T2,.FXDIR(I)	;POINT TO INPUT DIRECTORY
	MOVEI	T3,Q.FDIR(J)	;POINT TO QUEUE REQUEST
	HRLI	T3,-.FXLND	;SET COUNT
GETMDL:	SKIPE	T1,(T2)		;GET REQUEST DIRECTORY
	ADDI	T2,2		;ADVANCE FETCH
	MOVEM	T1,(T3)		;STORE RESULT
	AOBJN	T3,GETMDL	;LOOP FOR FULL DEPTH
	MOVE	T1,.FXNAM(I)	;GET FILE NAME
	MOVEM	T1,Q.FNAM(J)	;STORE
	HLLZ	T1,.FXEXT(I)	;GET EXTENSION NAME
	MOVEM	T1,Q.FEXT(J)	;STORE
	MOVE	T1,I.STRT(I)	;GET STARTING POINT
	MOVEM	T1,Q.FBIT(J)	;STORE
	MOVE	T1,I.MOD(I)	;GET SWITCHES
	MOVEM	T1,Q.FMOD(J)	;STORE
	MOVEI	T2,.FXDIM(I)	;POINT TO USER'S DIRECTORY MASKS
	MOVEI	T3,Q.FDRM(J)	;POINT TO QUEUE REQUEST
	HRLI	T3,-.FXLND	;SET COUNT
GETMDM:	MOVE	T1,(T2)		;FETCH MASK
	MOVEM	T1,(T3)		;STORE
	SKIPE	-1(T2)		;SEE IF AT END
	ADDI	T2,2		;NO--ADVANCE POINTER
	AOBJN	T3,GETMDM	;LOOP UNTIL DONE
	MOVE	T1,.FXNMM(I)	;GET NAME MASK
	MOVEM	T1,Q.FNMM(J)	;STORE
	HRLZ	T1,.FXEXT(I)	;GET EXT. MASK
	MOVEM	T1,Q.FEXM(J)	;STORE
	MOVE	T1,I.MODM(I)	;GET SWITCH MASK
	MOVEM	T1,Q.FMDM(J)	;STORE
	DMOVE	T1,I.RPT(I)	;GET /REPORT SWITCH
	DMOVEM	T1,Q.FRPT(I)	;AND SAVE IT
	JRST	.POPJ1		;RETURN
SUBTTL	General Subroutines

IFN FTUUOS,<

;GTTABS IS DRIVEN BY THREE TABLES GENERATED BY THE "TABS" MACRO.
;	THE FIRST TABLE CONTAINS THE ARGUMENT TO GETTAB, THE SECOND,
;	CONTAINS DEFAULTS TO USE ON FAILURE, AND THE THIRD CONTAINS
;	AN INSTRUCTION WHICH IS EXECUTED TO STORE THE RESULTS.

GTTABS:	MOVSI	T2,-.NMTAB		;MAKE AN AOBJN POINTER
GTTAB1:	MOVE	T1,GTAB1(T2)		;GET AN ARGUMENT
	GETTAB	T1,			;DO THE GETTAB
	  MOVE	T1,GTAB2(T2)		;GET THE DEFAULT
	XCT	GTAB3(T2)		;STORE THE RESULT
	AOBJN	T2,GTTAB1		;AND LOOP
	POPJ	P,			;RETURN WHEN DONE

;THE ARGUMENTS TO THE TABS MACRO ARE:
;	1) ARGUMENT TO GETTAB
;	2) DEFAULT VALUE
;	3) INSTRUCTION TO STORE RESULT
;		(NOTE: MACRO EXPANSION GENERATES THE CORRECT AC FIELD
;			THEREFORE IT SHOULD BE BLANK IN THE ARGUMENT)


DEFINE TABS,<
	T	<%NSCMX>,<0>,<MOVEM G$CMAX>
	T	<%CNMMX>,<0>,<MOVEM G$MNMX>
	T	<-1,,.GTNM1>,<0>,<MOVEM G$NAM1>
	T	<-1,,.GTPRG>,<'QUENCH'>,<MOVEM G$PROG>
	T	<-1,,.GTNM2>,<0>,<MOVEM G$NAM2>
>  ;END DEFINE TABS
;NOW GENERATE THE TABLES

DEFINE T(A,B,C),<
	EXP	<A>
>

GTAB1:	TABS
	.NMTAB==.-GTAB1

DEFINE T(A,B,C),<
	EXP	<B>
>

GTAB2:	TABS

DEFINE T(A,B,C),<
	EXP	<C> + <T1>B12
>

GTAB3:	TABS

>  ;END IFN FTUUOS FROM PREVIOUS PAGE
;ROUTINE TO GET TIME OF DAY

GETNOW:

IFN FTUUOS,<
	MOVX	T1,%CNDTM		;GETTAB FOR DATE-TIME
	GETTAB	T1,			;GET IT
	  JFCL
	MOVEM	T1,NOW			;SAVE ANSWER
	POPJ	P,			;AND RETURN
>  ;END IFN FTUUOS

IFN FTJSYS,<
	GTAD				;GET TIME AND DATE
	MOVEM	T1,NOW			;SAVE IT
	POPJ	P,			;AND RETURN
>  ;END IFN FTJSYS
	SUBTTL	COMMAND SCANNING SUBROUTINES

;GTCLIK -- GET AND CLEAR INPUT PARAM AREA--PRESET TO /OKNONE/UNPRES

;CALL:	PUSHJ	P,GTCLIK
;RETURNS WITH I=START OF AREA, T1=END OF AREA
;USES T2, T3

GTCLIK:	PUSHJ	P,GTCLIN	;GET AND CLEAR AREA
	MOVE	I,T1		;POINT TO REQUEST
	ADDI	T1,-1(T2)	;POINT AT END
	MOVX	T2,X.UNP  	;GET /UNPRES
	MOVEM	T2,I.MOD(I)	;SET FLAG ON
	MOVEM	T2,I.MODM(I)	;INDICATE FLAG PRESENT
	MOVX	T2,FX.NOM	;GET /OKNONE
	IORM	T2,.FXMOD(I)	;SET FLAG ON
	IORM	T2,.FXMOM(I)	;INDICATE FLAG PRESENT
	SETOM	.FXSNC(I)	;CLEAR /SINCE
	SETOM	.FXBFR(I)	;CLEAR /BEFORE
	MOVSI	T2,'*  '	;SET WILD-CARD
	MOVEM	T2,.FXNAM(I)	;IN REQUEST
	POPJ	P,		;RETURN
;GTCLIN -- GET AND CLEAR ONE INPUT FILE PARAMETER STORAGE AREA
;CALL:	PUSHJ	P,GTCLIN
;RETURNS WITH T1=START OF AREA, T2=LENGTH OF AREA
;USES T3

GTCLIN:	MOVE	T2,.JBFF	;START AT .JBFF
	GCORE	I.LZER		;GET ONE AREA
	MOVEI	T1,1(T1)	;ADVANCE ONE AND
	MOVEM	T1,I.NXZR	;SAVE NEW END
	SETZM	(T2)		;CLEAR AREA
	HRLZI	T3,(T2)		; ..
	HRRI	T3,1(T2)		; ..
	BLT	T3,-1(T1)	; ..
	SETOM	.FXBFR(T2)	;CLEAR FIRST SWITCH (-1 MEANS NONE SPYC)
	HRLZI	T3,.FXBFR(T2)	;GET ADR,,0
	HRRI	T3,.FXBFR+1(T2)	;GET ADR,,ADR+1
	BLT	T3,.FXLEN(T2)	;AND RESET ALL SWITCHES
	MOVE	T1,T2		;POSITION RESULT
	MOVEI	T2,I.LZER	;GET LENGTH
	POPJ	P,		;RETURN




;GCORE. -- GET CORE STARTING AT .JBFF
;CALL:	GCORE	N
;RETURN WITH T1=END OF AREA

GCORE.:	ADDB	T1,.JBFF	;ADVANCE .JBFF THE SPACE
GCORE1:	MOVE	T1,.JBFF	;GET NEW CORE SIZE
	CAMG	T1,.JBREL	;SEE IF STILL IN CORE
	SOJA	T1,.POPJ	;RETURN POINTING TO LAST
	CORE	T1,		;NO--ASK MONITOR FOR MORE
	  JRST	.+2		;IF FAIL
	JRST	GCORE1		;IF WON, LOOP BACK TO EXIT
	MOVEI	T1,[ASCIZ /
? Insufficient core in QUEUE
/]
	PUSHJ	P,.TSTRG##
	CLRBFI			;CLEAR TYPEAHEAD
	PUSHJ	P,.MONRT##	;RETURN TO MONITOR
	JRST	GCORE1		;AND LOOP BACK
;HERE TO READ IN SIGNED DECIMAL NUMBER (/DEPENDENCY)

DEPSW:	PUSHJ	P,.TIAUC##	;GET SIGN IF PRESENT
	MOVEI	T2,0		;CLEAR FLAGS
	CAIN	C,"+"		;SEE IF INCREMENT
	TRO	T2,1B19		;YES--SET FLAG
	CAIN	C,"-"		;SEE IF DECREMENT
	TRO	T2,1B18		;YES--SET FLAG
	TRNE	T2,3B19		;SEE IF EITHER SET
	PUSHJ	P,.TIAUC##	;YES--GET ONE MORE CHARACTER
	PUSHJ	P,.DECNC##	;GET NUMBER
	JUMPL	N,E.SVTL	;ERROR IF NEGATIVE
	CAIL	N,3B19		;MAKE SURE IT'S SMALL ENOUGH
	JRST	E.SVTL		;NO--GIVE ERROR
	IOR	N,T2		;COMBINE FLAGS
	PJRST	.SWDPB##	;GO STORE RESULT

E.SVTL:	N$FATE	<SVT>,<D>,<Switch value too large>


;HERE WHEN SWITCH VALUE IS A RADIX-60 SPECIFICATION (/TIME)
TIMESW:	PUSHJ	P,RDX60W	;GET RADIX 60 NUMBER
	PJRST	.SWMAX##	;AND STORE ANSWER


;HERE ON /METERS
METESW:	PUSHJ	P,.SWDEC##	;GET DECIMAL ARGUMENT
	PUSH	P,N+1		;SAVE THE AC FOR THE DIVIDE
	IMULI	N,^D3937	;CONVERT TO CENTI-INCHES
	IDIVI	N,^D1200	;CONVERT TO FEET
	POP	P,N+1		;RESTORE N+1
	PJRST	.SWMAX##	;AND STORE THE ANSWER


IFN FTJSYS,<
;HERE /USER:NAME SWITCH
SWUSER:	PUSHJ	P,.SWASQ##	;GET THE STRING
	MOVE	T1,[.NMUL##,,UBLOCK]
	BLT	T1,UBLOCK+7	;BLT THE STRING
	PJRST	.SWDPB##	;STORE 0 AND RETURN
>  ;END IFN FTJSYS
DEFINE	SWTCHS,<

	XLIST
	SP AFTER,S.AFT,.SWDTF##,AFT,FS.VRQ!FS.NFS
	SN ALLFILES,S.ALLF
	SP BEGIN,F.STRT,.SWDEC##,STR,FS.VRQ
	SS *CHECK,S.LIST,LISTCHECK
	SP COPIES,<POINTR(F.MOD,X.COP)>,.SWDEC##,COP,FS.VRQ
	SS CREATE,S.OPN,.QORCR
	SP DEADLINE,S.DED,.SWDTF##,DED,FS.VRQ
	SN DEFER,S.DFR
	SS DELETE,<POINTR (F.MOD,X.DISP)>,DISPDELETE
	SP DEPENDENCY,S.DPN,DEPSW,DPN,FS.VRQ
	SL DISPOSE,<POINTR(F.MOD,X.DISP)>,DISP,DISPPRESERVE
	SS ERBINARY,<POINTR(F.MOD,X.OKBN)>,0
	SS *FAST,S.LIST,LISTFAST
	SL FILE,<POINTR(F.MOD,X.FILE)>,FILE,FILEASCII
	SP FORMS,S.FRM,.SWSIX##,,FS.VRQ
	SN HEADER,<POINTR(F.MOD,X.NOHD)>
	SS KILL,S.OPN,.QORKL
	SP LIMIT,S.LIM,.SWDEC##,LIM
	SL *LIST,S.LIST,LIST,LISTJOBS
	SP MET,S.LPTP,METESW,PTP
	SP METERS,S.LPTP,METESW,PTP
	SP METRES,S.LPTP,METESW,PTP
	SS MODIFY,S.OPN,.QORMD
	SN NEW,<POINTR(F.MOD,X.NEW)>
	SP NOTES,<POINT 63,S.NOT>,.SWSXQ##,,FS.VRQ
	SN NULL,S.NULL
	SS OKBINARY,<POINTR(F.MOD,X.OKBN)>,1
	SL OUTPUT,S.OUT,OUTP,OUTPLOG
	SP PAGES,S.LLPT,.SWDEC##,LPT
	SS PRESERVE,<POINTR (F.MOD,X.DISP)>,DISPPRESERVE
	SL PRINT,<POINTR(F.MOD,X.PAPR)>,PRIN,PRINARROW
	SP PRIORITY,S.PRI,.SWDEC##,PRI
	SN REMOVE,<POINTR(F.MOD,X.REMV)>
	SP REPORT,<POINT 63,F.RPT>,.SWSXQ##,,FS.VRQ
	SN RESTARTABLE,S.RSTR
	SP SEQUENCE,S.SEQ,.SWDEC##,SEQ
	SL *SPACES,<POINTR(F.MOD,X.SPAC)>,SPAC,SPACSINGLE
	SL *SPACING,<POINTR(F.MOD,X.SPAC)>,SPAC,SPACSINGLE
	SP TAG,F.STRT,.SWSIX##,,FS.VRQ
	SP TIME,S.LTIM,TIMESW,TIM,FS.LRG
	SP UNIQUE,S.UNIQ,.SWDEC##,UNI
IFN FTUUOS,<
	SP CARDS,S.LCDP,.SWDEC##,CDP,FS.VRQ!FS.NFS
	SP FEET,S.LPTP,.SWDEC##,PTP
	SP PATH,DEFFIL,.SWFIL##,PTH,FS.VRQ
	SL PLOT,<POINTR(F.MOD,X.PAPR)>,PLOT,PLOTIMAGE
	SL PUNCH,<POINTR(F.MOD,X.PAPR)>,PUNC,PUNCASCII
	SL TAPE,<POINTR(F.MOD,X.PAPR)>,TAPE,TAPEASCII
	SP TPLOT,S.LPLT,.SWDEC##,PLT
	SN UNPRESERVED,<POINTR(F.MOD,X.UNP)>
>  ;END IFN FTUUOS

IFN FTJSYS,<
	SP USER,S.USER,SWUSER,,FS.VRQ
>  ;END IFN FTJSYS

IFN INPCOR,<
	SP CORE,S.COR,.SWCOR##,COR,FS.LRG!FS.VRQ
>  ;END IFN INPCOR

	LIST
>
;NOW BUILD THE TABLES FROM THE SWTCHS MACRO

	DOSCAN(SWTCH)


;KEY WORD VALUES

KEYS	DISP,<PRESERVE,%%,DELETE>

KEYS	FILE,<ASCII,FORTRAN,COBOL,$$,%%,ELEVEN>

KEYS	LIST,<FAST,JOBS,SUMMARY,ALL,CHECK>

KEYS	OUTP,<NOLOG,LOG,ERROR>

KEYS	PLOT,<IMAGE,ASCII,BINARY>

KEYS	PRIN,<ARROW,ASCII,OCTAL,SUPPRESS>

KEYS	PUNC,<ASCII,026,BINARY,BCD,IMAGE,MNEMONIC>

KEYS	SPAC,<SINGLE,DOUBLE,TRIPLE>

KEYS	TAPE,<ASCII,IMAGE,IBINARY,BINARY>
;QUETYP -- IDENTIFY WHAT TYPE OF QUEUE HAS BEEN SPECIFIED
;
;CALL:	PUSHJ	P,QUETYP
;	RETURNS T1=-1 IF /LIST REQUEST
;		    0 IF INP:
;		    1+IF OUTPUT QUEUES IN ORDER OF QUEUES MACRO
;
;	ALSO RETURNS O.DEV AND QTYPE UPDATED
;USES T2, T3, T4
;
;WARNING:  THIS ROUTINE IS CALLED BEFORE AND AFTER THE DEFAULTER, SO
;	IT MAY BE LOOKING AT UNDEFAULTED DATA.

QUETYP:	MOVEI	T1,.QORLS	;MAY NEED TO SET /LIST
	SKIPL	S.LIST		;SEE IF /LIST:VALUE
	SKIPLE	S.OPN		;YES--SEE IF SOME OTHER OPERATION
	JRST	.+2		;YES--DO OTHER ONE
	MOVEM	T1,S.OPN	;NO--SET /LIST
	SETOM	T1		;SET ANSWER IF /LIST
	MOVE	T2,S.OPN	;GET OPERATION CODE
	CAIN	T2,.QORLS	;SEE IF /LIST
	JRST	QUETY1		;YES, RETURN THE ANSWER

	PUSH	P,N		;SAVE N
	SKIPGE	O.MOD		;SEE IF NULL DEVICE
	SETZM	O.DEV		;YES--CLEAR IT OUT
	....==FX.NDV
	SKIPN	N,O.DEV		;NO--GET OUTPUT DEVICE
	SKIPE	N,DQTYPE	;USE DEFAULT FROM COMMAND
	SKIPA			;OK
	MOVSI	N,'LPT'		;DEFAULT DEVICE
	PUSHJ	P,XPNQUE	;EXPAND AND MATCH QUEUE NAME
	MOVEM	N,O.DEV		;AND STORE IT
	POP	P,N		;RESTORE NAME
	MOVEI	T1,(T1)		;CHANGE TO INDEX
	SUBI	T1,QUENMT	; ..
QUETY1:	MOVEM	T1,QTYPE	;STORE AWAY THE ANSWER
	POPJ	P,		;AND RETURN
DEFINE	QQ(A,B,C,D,E,F,G,H),<
	SIXBIT	/A/
>

			;SWITCH TO LOW SEG
	SWSEG
QUENMA:	SIXBIT	/ALL/		;FOR LISTING ONLY
QUENMT:	QUEUES
	QUENML==.-QUENMT
			;SWITCH TO HIGH SEG
	SWSEG

;XPNQUE -- EXPAND QUEUE NAME ABBREVIATION IF ANY
;CALL:	MOVE	N,NAME IN SIXBIT AS TYPED IN
;	PUSHJ	P,XPNQUE
;RETURN WITH UPDATED N
;	AND WITH T1 = ADDRESS OF ENTRY
;USES M, T2, T3, T4

XPNQUE:	MOVS	T1,N		;COPY OVER THE ARGUMENT
	ANDI	T1,777700	;AND TO FIRST TWO CHARS
	CAIE	T1,'LL '	;IS IT LL
	CAIN	T1,'LU '	;OR LU?
	JRST	XPNQU2		;YES, JUMP
	TRNE	N,-1		;IS RIGHT-HALF NULL?
	JRST	XPNQU1		;NO, A BIG NAME
	MOVE	T1,[IOWD QUENML+1,QUENMA]
	PUSHJ	P,.NAME##	;GET LOOK FOR A MATCH
	  JRST	E.IQN		;ILLEGAL QUEUE NAME
	MOVE	N,0(T1)		;GET REAL NAME
	POPJ	P,		;AND RETURN

XPNQU1:	PUSH	P,N		;SAVE THE ARGUMENT
	TRZ	N,-1		;ZAP RH
	MOVE	T1,[IOWD QUENML+1,QUENMA]
	PUSHJ	P,.NAME##	;FIND IT
	  JRST	E.IQN		;ILLEGAL QUEUE NAME
	POP	P,N		;OK, RESTORE REAL NAME
	POPJ	P,		;AND RETURN

XPNQU2:	MOVEI	T1,QTPLPT+QUENMT ;LU AND LL ARE LPTS
	POPJ	P,		;RETURN


E.IQN:	N$FATE	<IQN>,<N>,<Illegal queue name>
;RDX60W -- INPUT A RADIX 60 NUMBER FROM COMMAND STRING
;RDX60  -- DITTO (CHARACTER ALREADY IN C)
;FORMATS ARE XXYYZZ OR XX:YY:ZZ
;CALL:	PUSHJ	P,RDX60/RDX60W
;	RETURN WITH WORD IN N
;USES T1, T2, T3	UPDATES C (SEPARATOR)

RDX60W:	PUSHJ	P,.TIAUC##	;PRIME THE PUMP

RDX60:	MOVEI	T2,0		;PRESET TEMPORARY RESULT
RDX601:	IMULI	T2,^D100	;ADVANCE TO NEXT RESULT
	PUSHJ	P,.DECNC##	;GET NEXT SUPER-DIGIT
	JUMPL	N,E.TCTL	;ERROR IF NEGATIVE
	ADD	T2,N		;ADD TO ACCUMULATOR
	CAIE	C,":"		;SEE IF MORE TO COME
	JRST	RDX605		;NO--GO CONVERT RESULT
	TLNE	T2,(777B8)	;DON'T ALLOW OVERFLOW
	JRST	E.TTL		;ERROR IF TIME TOO LARGE
	CAILE	N,^D60		;DON'T ALLOW GARBAGE IN
	JRST	E.TCTL		;ERROR IF DIGIT TOO LARGE
	PUSHJ	P,.TIAUC##	;SKIP SEPARATOR
	JRST	RDX601		;LOOP BACK FOR MORE

RDX605:	MOVEI	N,0		;CLEAR RESULT
	MOVEI	T1,3		;INITIALIZE TO ALLOW THREE FIELDS
RDX606:	IDIVI	T2,^D100	;SEPARATE TYPEIN
	HRLM	T3,(P)		;STORE LEAST DIGIT AWAY
	JUMPE	T2,RDX607	;JUMP IF ALL DONE
	SOJLE	T1,E.IFT	;GIVE AN ERROR IF TOO MANY FIELDS
	PUSHJ	P,RDX606	;IF NOT, DO SOME MORE

RDX607:	HLRZ	T1,(P)		;GET BACK HIGHEST DIGIT
	IMULI	N,^D60		;MAKE ROOM IN RESULT
	ADD	N,T1		;INCLUDE RESULT
	CAILE	T1,^D60		;SEE IF ERROR
	JRST	E.TCTL		;COMPLAIN IF COMPONENT TOO BIG
	POPJ	P,		;RETURN

E.TTL:	MOVE	N,T2		;GET ERROR
	N$FATE	<TTL>,<D>,<Time too large>
E.TCTL:	N$FATE	<TCT>,<D>,<Time component too large>

E.IFT:	N$FATE	<IFT>,,<Illegal format in time specification>
	SUBTTL	SUBROUTINES FOR LISTING OUTPUT


			;SWITCH TO LOW SEG
	SWSEG


;LTIMEM/LQTIME/LTIME -- OUTPUT TIME IN FORM HH:MM:SS
;CALL:	MOVE	T1,TIME-IN-MINUTES
;	PUSHJ	P,LTIMEM
;	-OR-
;	MOVE	T1,TIME-IN-QUEUE-FORMAT
;	PUSHJ	P,LQTIME
;		IF GE 1 DAY, NDHH:MM:SS
;	-OR-
;	MOVE	T1,TIME-IN-SECONDS
;	PUSHJ	P,LTIME

;THIS PICTURES THE QUEUE TIME AS A NUMBER OF DAYS WITH THE BINARY
; POINT AT BIT 17. THE OUTPUT IS SECONDS WITH THE BINARY POINT AT BIT
; 35.
LQTIME:	MOVE	T4,T1		;SAVE TIME
	HLRZ	T1,T1		;GET DAYS
	JUMPE	T1,LQTIM1	;OK IF SOON
	PUSHJ	P,LDEC		;LIST DAYS
	MOVEI	C,"d"		;GET DAYS INDICATOR
	PUSHJ	P,LCHR		;LIST IT
	HLRZ	T1,T4		;GET NUM DAYS
	CAIGE	T1,^D1000	;IF OVER 1000, NO SPACE
	PUSHJ	P,LSPC		;SEPARATE FOR READABILITY
LQTIM1:	HRRZ	T1,T4		;RESTORE TIME
	MULI	T1,^D60*^D60*^D24 ;MAKE MUCH LARGER
	LSHC	T1,^D18		;SET TO BE FULL WORD
	JRST	LTIME		;GO LIST AS SECONDS
LTIMEM:	TRO	F,R.NSEC	;SUPPRESS SECONDS
	IMULI	T1,^D60		;CONVERT MINUTES TO SECONDS
LTIME:	TRNE	F,R.NSEC	;SEE IF SECONDS
	ADDI	T1,^D30		;NO--ROUND OFF
	IDIVI	T1,^D3600	;GET HOURS
	IDIVI	T2,^D60		;GET MIN. AND SECS.
	PUSH	P,T3		;SAVE SECONDS
	PUSH	P,T2		;SAVE MIN.
	PUSHJ	P,LDEC2Z	;LIST HOURS
	MOVEI	C,":"		;LIST A COLON
	PUSHJ	P,LCHR		; ..
	POP	P,T1		;LIST MIN.
	PUSHJ	P,LDEC2Z	; ..
	POP	P,T1		;GET SECONDS AND FALL INTO DEC2Z
	TRZE	F,R.NSEC	;SEE IF NO SECONDS
	POPJ	P,		;RIGHT--RETURN
	MOVEI	C,":"		; ADD A COLON
	PUSHJ	P,LCHR		; ..
				;FALL HERE FROM ABOVE
;LDEC2Z -- LIST DECIMAL AT LEAST 2 DIGITS WITH LEADING ZERO
;CALL:	MOVEI	T1,NUMBER
;	PUSHJ	P,LDEC2Z
;USES T1, T2, T3, C

LDEC2Z:	MOVEI	C,"0"		;SETUP TO PRINT 0 IN CASE NEEDED
	CAIGE	T1,^D10		;TEST TO SEE IF NEEDED
	PUSHJ	P,LCHR		;YES--SEND IT
	PJRST	LDEC		;GO FINISH WORK

;LDEC5 -- LIST DECIMAL AT LEAST FIVE DIGITS
;LDEC4 -- LIST DECIMAL AT LEAST FOUR DIGITS
;LDEC3 -- LIST DECIMAL AT LEAST THREE DIGITS
;LDEC2 -- LIST DECIMAL AT LEAST TWO DIGITS
;CALL:	MOVEI	T1,NUMBER
;	PUSHJ	P,LDEC2
;USES T1, T2, T3, C

LDEC5:	CAIGE	T1,^D10000
	PUSHJ	P,LSPC
LDEC4:	CAIGE	T1,^D1000	;SEE IF NEEDED
	PUSHJ	P,LSPC
LDEC3:	CAIGE	T1,^D100
	PUSHJ	P,LSPC
LDEC2:	CAIGE	T1,^D10
	PUSHJ	P,LSPC		;YES
				;FALL INTO LDEC

;LDEC -- LIST DECIMAL NUMBER
;LOCT -- LIST OCTAL NUMBER
;LRDX -- LIST VIA PRESET RADIX
;CALL:	MOVEI	T1,NUMBER
;      (MOVEI	T3,RADIX    LRDX ONLY)
;	PUSHJ	P,LDEC/LOCT/LRDX
;USES T1, T2, T3, C

LDEC:	SKIPA	T3,[^D10]	;INITIALIZE FOR DECIMAL RADIX
LOCT:	MOVEI	T3,10		;INITIALIZE FOR OCTAL RADIX
LRDX:	JUMPGE	T1,LRDX1	;PROCEED IF POSITIVE
	MOVEI	C,"-"		;ELSE, GET NEGATIVE SIGN
	PUSHJ	P,LCHR		;LIST IT

LRDX1:	IDIV	T1,T3		;DIVIDE BY RADIX
	MOVMS	T2		;MAKE POSITIVE
	HRLM	T2,(P)		;SAVE REMAINDER
	SKIPE	T1		;SEE IF ANYTHING LEFT
	PUSHJ	P,LRDX1		;YES--LOOP BACK WITH PD LIST
	HLRZ	C,(P)		;GET BACK A DIGIT
	ADDI	C,"0"		;CONVERT TO ASCII
	PJRST	LCHR		;GO LIST IT
;LCRLF - LIST END OF LINE
;CALL:	PUSHJ	P,LCRLF
;USES M, C

LCRLF:	TRZ	F,R.LTAB	;CLEAR TAB MEMORY
	MOVEI	M,[ASCIZ /
/]
				;FALL INTO LSTR

;LSTR - LIST ASCII STRING
;CALL:	MOVEI	M,STRING (END WITH 0 BYTE)
;	PUSHJ	P,LSTR
;USES M, C

LSTR:	TLOA	M,(POINT 7,)	;CONVERT TO BYTE POINTER
LSTR1:	PUSHJ	P,LCHR		;OUTPUT CHARACTER
	ILDB	C,M		;GET NEXT CHARACTER
	JUMPN	C,LSTR1		;LOOP UNLESS NULL
	POPJ	P,		;RETURN
;LSIX  -- LIST SIXBIT WORD (AT LEAST ONE SPACE)
;LSIXN -- SAME EXCEPT 0 GIVES NO SPACES
;CALL:	MOVE	T2,WORD
;	PUSHJ	P,LSIX/LSIXN
;USES T1, T2, C

LSIX:	MOVEI	T1,0		;CLEAR NEXT CHARACTER
	LSHC	T1,6		;FETCH NEXT CHAR
	PUSHJ	P,LCHRS		;LIST IT IN SIXBIT

LSIXN:	JUMPN	T2,LSIX		;LOOP UNTIL ONLY BLANKS LEFT
	POPJ	P,		;RETURN


;LSIXC -- LIST SIXBIT WORD FIXED NUMBER OF CHARACTERS
;CALL:	MOVE	T2,WORD
;	MOVEI	T3,NUM CHARS TO PRINT
;	PUSHJ	P,LSIXC
;USES T1, T2, T3, C

LSIXC:	MOVEI	T1,0		;CLEAR NEXT CHAR
	LSHC	T1,6		;GET NEXT CHAR
	PUSHJ	P,LCHRS		;LIST IT IN SIXBIT
	SOJG	T3,LSIXC	;LOOP UNTIL DONE
	POPJ	P,		;RETURN


;LSPC2 -- LIST TWO SPACES
;CALL:	PUSHJ	P,LSPC2
;USES C

LSPC2:	PUSHJ	P,LSPC		;DO ONE
	PJRST	LSPC		;DO ANOTHER AND RETURN
	POPJ	P,		;FOR THE COUNTDOWN
;LTAB -- LIST TAB
;LSPC -- LIST SPACE
;LCHR -- LIST CHARACTER
;LCHRS-- LIST SIXBIT CHARACTER
;CALL:	(MOVEI	C,CHARACTER    IF LCHR)
;	(MOVEI	T1,CHARACTER IF LCHRS)
;	PUSHJ	P,LTAB/LSPC/LCHR
;USES C EXCEPT LCHR USES NO AC'S

LCHRS:	MOVEI	C," "-' '(T1)	;CONVERT TO ASCII AND MOVE TO C
LCHR:	CAIE	C,.CHTAB	;SEE IF A TAB
	JRST	LCHR1		;NO--GO SEND IT

LTAB:	TRON	F,R.LTAB	;SET/TEST TAB
	POPJ	P,		;RETURN IF NOT TWO IN A ROW

LTAB1:	SKIPA	C,[.CHTAB]	;GET THE TAB
LSPC:	MOVEI	C," "		;GET THE SPACE

LCHR1:	TRZE	F,R.LTAB	;CLEAR TAB MEMORY
	JRST	LCHR2		;IF SET, GO ISSUE ONE
	SOSG	B.LC+2		;SEE IF ROOM IN THE BUFFER
	PUSHJ	P,LCHRW		;NO--GO WRITE THIS BUFFER
	IDPB	C,B.LC+1	;YES--SEND CHARACTER
	CAIG	C,.CHFFD	;SEE IF END OF LINE
	PUSHJ	P,LCHRWL	;YES--OUTPUT IT IF DESIRED
	POPJ	P,		;RETURN

LCHR2:	PUSH	P,C		;SAVE REQUESTED CHARACTER
	PUSHJ	P,LTAB1		;SEND A TAB
	POP	P,C		;RESTORE CHARACTER
	JRST	LCHR1		;PROCEED
;LCHRWL -- ROUTINE TO OUTPUT BUFFER AT END OF LINE IF NEEDED
;LCHRW  -- ROUTINE TO OUTPUT BUFFER ALWAYS
;LCHRWR -- ROUTINE TO REPORT ON TRANSFER ERRORS
;CALL:	PUSHJ	P,XXX
;RETURNS WHEN DONE
;USES NO AC

LCHRWL:	TRNE	F,R.OUTL	;SEE IF LINE MODE OUTPUT
LCHRW:	OUT	LC,		;OUTPUT BUFFER
	  POPJ	P,		;OK--RETURN

LCHRWR:	PUSH	P,T1		;ERROR--SAVE SOME ACS
	PUSH	P,T2		; ..
	PUSH	P,T3		; ..
	GETSTS	LC,T1		;GET ERROR STATUS
	MOVE	T2,T1		;PREPARE TO CLEAR
	ANDI	T2,37777	;  BY PRESERVING JUST
	SETSTS	LC,(T2)		;  THE CONTROL BITS
	OUTSTR	[ASCIZ /
%QUELDE  Listing device output error, status /]
		N$$LDE==0
	MOVE	T3,[POINT 3,T1,17]  ;SETUP FOR OCTAL TYPEOUT
LCHRWE:	ILDB	T2,T3		;GET DIGIT
	ADDI	T2,"0"		;CONVERT TO ASCII
	OUTCHR	T2		;TYPE IT
	TLNE	T3,(77B5)	;SEE IF DONE YET
	JRST	LCHRWE		;NO--LOOP
	OUTSTR	[ASCIZ /
/]				;NOTE--ALL THIS DONE HERE IN CASE
				;  WRONG SEGMENT IN CORE

	POP	P,T3		;RESTORE ACS
	POP	P,T2		; ..
	POP	P,T1		; ..
	POPJ	P,		;AND RETURN
SUBTTL	Fatal Error Message Routines

	SWSEG			;SWITCH TO HISEG

;NFMSG  --  ISSUE FATAL MESSAGE AND RESTART JOB
;	CALLED BY N$FATE MACRO
;
NFMSG:	MOVEI	T2,.POPJ##		;NULL ROUTINE
	JRST	NFMSXE			;GO DO THE REST

;NFMSGN  --  ISSUE FATAL MESSAGE, TYPE N IN SIXBIT, AND RESTART JOB
;	CALLED BY N$FATE MACRO
;
NFMSGN:	MOVEI	T2,.TSIXN##		;THE ROUTINE TO CALL
	JRST	NFMSXE			;GO DO THE REST

;NFMSGD  --  ISSUE FATAL MESSAGE, TYPE N IN DECIMAL, AND RESTART JOB
;	CALLED BY N$FATE MACRO
;
NFMSGD:	MOVEI	T2,.TDECW##		;THE ROUTINE TO CALL
	JRST	NFMSXE			;AND GO FINISH UP

;NFMSGO  --  ISSUE FATAL MESSAGE, TYPE N IN OCTAL, AND RESTART JOB
;	CALLED BY N$FATE MACRO
;
NFMSGO:	MOVEI	T2,.TOCTW##		;THE OCTAL ROUTINE
					;AND FALL INTO NFMSXE

;HERE TO PRINT THE MESSAGE AND CALL THE ROUTINE SETUP ABOVE
;
NFMSXE:	PUSH	P,T2			;SAVE T2 FOR LATER
	MOVE	T2,(T1)			;GET CODE IN T2
	MOVEI	T1,1(T1)		;GET PC+1 INTO T1
	EXCH	T1,T2			;SWAP THEM
	HRLI	T1,'QUE'		;GET A PREFIX
	HRLI	T2,"?"			;GET A QUESTION MARK
	PUSHJ	P,.ERMSG##		;TYPE THE ERROR MESSAGE
	PUSHJ	P,.TSPAC##		;TYPE A SPACE
	POP	P,T2			;GET THE ROUTINE BACK
	MOVE	T1,N			;GET THE ARGUMENT
	PUSHJ	P,(T2)			;CALL IT
NFMSX1:	PUSHJ	P,.CLRBF##		;CLEAR OUT TYPE AHEAD
	PUSHJ	P,.TCRLF##		;TYPE A CRLF
	PUSHJ	P,.TCRLF##		;AND ANOTHER ONE
	MOVE	P,[IOWD LN$PDL,PDLST]	;RESET PDL
	JRST	QUELOP			;AND START OVER
SUBTTL	Non-fatal Error Message Routines


;;;WARNING MESSAGES
FWARNN:	PUSH	P,N			;SAVE N
	HRLI	N,.TSPAC##		;ROUTINE TO CALL
	JRST	FWARN1			;AND CONTINUE

FWARN:	PUSH	P,N			;SAVE N
	HRLI	N,.TCRLF##		;ROUTINE TO CALL
					;AND FALL INTO COMMON CODE


FWARN1:	HRR	N,-1(P)			;GET ADDRESS OF ARGS
	PUSHJ	P,.PSH4T##		;SAVE SOME ACS
	HLRZ	T1,0(N)			;GET CODE
	HRLI	T1,'QUE'		;FILL IN CONSTANT PART
	HRRZ	T2,0(N)			;GET ADR OF MESSAGE
	HRLI	T2,"%"			;GET PREFIX
	PUSHJ	P,.ERMSG##		;TYPE THE MESSAGE
	MOVSS	N			;GET ADR OF ROUTINE IN RH
	PUSHJ	P,(N)			;CALL IT
	PUSHJ	P,.POP4T##		;RESTORE SOME ACS
	POP	P,N			;RESTORE N
	PJRST	.POPJ1##		;AND SKIP BACK OVER ARGS


;;;INFORMATION
FINFON:	PUSH	P,N			;SAVE N
	HRLI	N,.TSPAC##		;GET ADDRESS OF ROUTINE
	JRST	FINFO1			;AND CONTINUE

FINFO:	PUSH	P,N			;SAVE N
	HRLI	N,FINFO2		;ADDRESS OF ROUTINE
					;AND FALL THRU


FINFO1:	HRR	N,-1(P)			;GET ADDRESS OF ARGS
	PUSHJ	P,.PSH4T##		;SAVE SOME ACS
	HLRZ	T1,0(N)			;GET CODE
	HRLI	T1,'QUE'		;FILL IN CONSTANT PART
	HRRZ	T2,0(N)			;GET ADR OF MESSAGE
	HRLI	T2,"["			;GET PREFIX
	PUSHJ	P,.ERMSG##		;TYPE THE MESSAGE
	MOVSS	N			;GET ADR OF ROUTINE IN RH
	PUSHJ	P,(N)			;CALL IT
	PUSHJ	P,.POP4T##		;RESTORE SOME ACS
	POP	P,N			;RESTORE N
	PJRST	.POPJ1##		;AND SKIP BACK OVER ARGS


FINFO2:	MOVEI	T1,"]"			;A CLOSE
	PUSHJ	P,.TCHAR##		;TYPE IT
	PJRST	.TCRLF##		;TYPE A CRLF AND RETURN
SUBTTL	STORAGE

	XLIST		;LITERALS
	LIT
	LIST

			;SWITCH TO LOW SEG
	SWSEG

LOWFWA:!		;START OF LOW DATA AREA
SAVCOR:	BLOCK	1	;INITIAL VALUE OF LOW SEG CORE SIZE
NOW:	BLOCK	1	;CURRENT SYSTEM DATE/TIME
STRTOF:	BLOCK	1	;STARTING ADDRESS OFFSET



ISARG:	BLOCK	2	;FUDGE TO SET UP TYPEOUT ADDRESS   ;;;;;;KEEP
TYPER:	BLOCK	2	;ADDRESS OF TYPE CHARACTER ROUTINE ;;;;;;IN
MONRTR:	BLOCK	1	;ADDRESS OF MONRET ROUTINE	   ;;;;;;ORDER
ZCOR:!			;START OF AREA TO ZERO ON INITIAL LOAD

PDLST:	BLOCK	LN$PDL+1  ;PUSH-DOWN LIST
OPNBLK:	BLOCK	3	;OPEN BLOCK

LKBLK:	BLOCK	1	;EXTENDED LOOKUP BLOCK
RIBPPN:	BLOCK	1	;DIRECTORY
RIBNAM:	BLOCK	1	;FILE NAME
RIBEXT:	BLOCK	1	;FILE EXTENSION
RIBPRV:	BLOCK	1	;PROTECTION WORD
RIBSIZ:	BLOCK	1	;FILE SIZE
	BLOCK	1	;JUNK
RIBSPL:	BLOCK	1	;SPOOLING NAME
	BLOCK	6	;JUNK
RIBDEV:	BLOCK	1	;LOCATION OF FILE (LOGICAL UNIT)
LKBLKL==.-LKBLK


P.ZER:!			;START OF AREA FOR FILE DEFAULTS
P.MOD:	BLOCK	1	;LAST STICKY FILE SWITCHES TYPED BY USER
P.MODM:	BLOCK	1	;LAST STICKY FILE SWITCHES MASK TYPED BY USER
P.EZER==.-1
P.MIN:!
P.STRT:	BLOCK	1	;LAST STICKY FILE STARTING POINT
P.RPT:	BLOCK	2	;REPORT NAME
P.EMIN==.-1

F.ZER:!			;START OF AREA FOR FILE TYPE-INS
F.MOD:	BLOCK	1	;FILE SWITCHES
F.MODM:	BLOCK	1	;FILE SWITCH MASK (ON IF TYPED)
F.EZER==.-1
F.MIN:!
F.STRT:	BLOCK	1	;FILE STARTING POINT
F.RPT:	BLOCK	2	;/REPOR KEY
F.EMIN==.-1


;GETTAB INFO
G$NAM1:	BLOCK	1			;FIRST HALF OF USER'S NAME
G$NAM2:	BLOCK	1			;SECOND HALF OF USER'S NAME
G$CMAX:	BLOCK	1			;SYSTEM CORMAX
G$MNMX:	BLOCK	1			;MINMAX
G$PROG:	BLOCK	1			;PROGRAM NAME
S.ZER:!
COMDEV:	BLOCK	1	;COMMAND-DEVICE FOR CURRENT REQUEST
QTYPE:	BLOCK	1	;QUEUE TYPE FOR CURRENT REQUEST
OSCNML:	BLOCK	2	;COMMANDS FOR .OSCAN

DEFFIL:	BLOCK	.FXLEN		;/PATH:[DIRECTORY]
DEFDIR=DEFFIL+.FXDIR
MX.PTH==.FXLEN
PD.PTH==0
O.ZER:!			;START OF OUTPUT SPEC STORAGE
O.DEV:	BLOCK	1	;DEVICE
O.NAM:	BLOCK	1	;NAME
O.NAMM:	BLOCK	1	;NAME MASK
O.EXT:	BLOCK	1	;EXT,,MASK
O.MOD:	BLOCK	1	;SCAN SWITCHES
O.MODM:	BLOCK	1	;SCAN SWITCH MASK
O.DIR:	BLOCK	1	;DIRECTORY
O.DIRM:	BLOCK	2*.FXLND-1	;DIRECTORY MASK
	BLOCK	O.ZER+.FXLEN-1-.;SPACE FOR SWITCH PARAMETERS
O.LZER==.-O.ZER

IFN FTJSYS,<
UBLOCK:	BLOCK	10		;USER NAME BLOCK
>  ;END IFN FTJSYS

L.OPEN:	BLOCK	3	;OPEN BLOCK
L.LOOK:	BLOCK	LN$ENT	;LOOKUP BLOCK
PTHFCN:	BLOCK	.PTMAX	;PATH. ARGS
PTHPPN=PTHFCN+.PTPPN

PTFFCN:	BLOCK	.PTMAX		;FILE PATH BLOCK
PTFPPN=PTFFCN+.PTPPN


I.INZR:	BLOCK	1	;INITIAL INPUT SPEC STORAGE
I.NXZR:	BLOCK	1	;POINTER TO NEXT INPUT SPEC STORAGE
I.LSZR:	BLOCK	1	;POINTER TO LAST INPUT SPEC STORAGE
S.EZER==.-1





	RELOC	QUENCH			;SAVE SPACE

	PHASE	0
	BLOCK	.FXLEN	;SCAN'S AREA
I.MOD:!	BLOCK	1	;SWITCHES
I.MODM:!BLOCK	1	;SWITCH MASK (ON IF USER SUPPLIED)
I.STRT:!BLOCK	1	;FILE STARTING POINT
I.RPT:!	BLOCK	2	;/REPORT SWITCH
I.LZER:!
	PHASE	0	;DEFINE QUEUE AREA (RELOCATABLE)
Q.ZER:!			;START OF QUEUE PARAMETER AREA
Q.MEM:!	BLOCK	1	;USED FOR CHARACTER TYPER
Q.OPR:!	BLOCK	1	;OPERATION CODE
Q.LEN:!	BLOCK	1	;LENGTHS IN AREA
Q.DEV:!	BLOCK	1	;DESTINATION DEVICE
Q.PPN:!	BLOCK	1	;PPN ORIGINATING REQUEST
Q.JOB:!	BLOCK	1	;JOB NAME
Q.SEQ:!	BLOCK	1	;JOB SEQUENCE NUMBER
Q.PRI:!	BLOCK	1	;EXTERNAL PRIORITY
Q.PDEV:!BLOCK	1	;PROCESSING DEVICE
Q.TIME:!BLOCK	1	;PROCESSING TIME OF DAY  (PPN MASK ON MODIFY)
Q.CREA:!BLOCK	1	;CREATION TIME  (JOB NAME MASK ON MODIFY)
Q.AFTR:!BLOCK	1	;AFTER PARAMETER
Q.DEAD:!BLOCK	1	;DEADLINE TIME
Q.CNO:!	BLOCK	1	;CHARGE NUMBER
Q.USER:!BLOCK	2	;USER'S NAME

Q.I:!			;START OF INPUT QUEUE AREA
Q.IDEP:!BLOCK	1	;DEPENDENCY WORD
			;    0: /RESTARTABLE
			;  1-2: 1+/UNIQUE
			;    3: 1 IF /MODIFY/RESTARTABLE
			;  4-5: (FUTURE)
			;  6-8: /OUTPUT
			; 9-17: (FUTURE)
			;18-19: TYPE OF /DEPENDENCY
			;	0  ABSOLUTE
			;	1  +
			;	2  -
			;	3  NO CHANGE
			;20-35: /DEPENDENCY VALUE
Q.ILIM:!BLOCK	3	;JOB LIMITS
Q.IDDI:!BLOCK	.FXLND	;JOB'S DIRECTORY
Q.II:!			;START OF FILE AREA
Q.ILEN==.-Q.ZER

	PHASE	Q.I
Q.O:!			;START OF OUTPUT QUEUE AREA
Q.OFRM:!BLOCK	1	;FORMS REQUEST
Q.OSIZ:!BLOCK	1	;LIMIT WORD
Q.ONOT:!BLOCK	2	;ANNOTATION
Q.FF:!
	PHASE	0
Q.F:!			;DUPLICATED AREA FOR EACH REQUESTED FILE
Q.FSTR:!BLOCK	1	;FILE STRUCTURE
Q.FDIR:!BLOCK	.FXLND	;ORIGINAL DIRECTORY
Q.FNAM:!BLOCK	1	;ORIGINAL NAME
Q.FEXT:!BLOCK	1	;ORIGINAL EXTENSION
Q.FRNM:!BLOCK	1	;RENAMED FILE NAME (0 IF NOT)
Q.FBIT:!BLOCK	1	;BIT 0=PRESERVED BY QUEUE, REST=STARTING BIT
Q.FMOD:!BLOCK	1	;FILE SWITCHES
Q.FRPT:!BLOCK	2	;/REPORT KEY

	Q.FLEN==.-Q.F

Q.FDRM:!BLOCK	.FXLND	;DIRECTORY MASK
Q.FNMM:!BLOCK	1	;FILE NAME MASK
Q.FEXM:!BLOCK	1	;FILE EXT MASK
Q.FMDM:!BLOCK	1	;MODIFIER MASK
Q.FLNM==.-Q.F
	DEPHASE
	RELOC	S.EZER+1
T.ZER:!			;START OF TEMPORARY DATA AREA
NOBLKS:	BLOCK	1	;ACCUMULATED NUMBER OF BLOCKS TO BE PROCESSED
CREFLG:	BLOCK	1	;FLAG 0 IF CREATE, -1 IF NOT
DQTYPE:	BLOCK	1	;WORD TO STORE OUTPUT QUEUE TYPE
			; FOR SUBMIT,PUNCH ...
COMIDX:	BLOCK	1	;INDEX INTO QCOMS RETURNED BY ISCAN
LOGCNT:	BLOCK	1	;COUNT DOWN TO LOG FILE
CTLSTR:	BLOCK	1	;CONTROL FILE STRUCTURE ON -20
NAFFLG:	BLOCK	1	;SET IF SOME FILE DOESN'T EXIST
T.EZER:!


;BUFFER POINTERS
B.LC:	BLOCK	3	;LISTING FILE

SAVEF:	BLOCK	1	;F SAVED HERE DURING LISTING PASSES
SAVEI:	BLOCK	1	;I SAVED HERE DURING LISTING PASSES
SAVEQ:	BLOCK	1	;Q SAVED HERE DURING LISTING PASSES
LSTA:	BLOCK	1	;STATION TO MATCH IN LISTING
ONEQUE:	BLOCK	1	;NAME OF DEVICE IN QUEUE


EZCOR==.-1		;END OF AREA TO ZERO

	END	QUENCH