Google
 

Trailing-Edge - PDP-10 Archives - cuspjul86upd_bb-jf24a-bb - 10,7/galaxy/queue/queue.mac
There are 9 other files named queue.mac in the archive. Click here to see a list.
IF2 <VTITLE \QUHVER,\QUHMIN,\QUHEDT,\QUHWHO>

SUBTTL Copyright and Version Information

;
;        COPYRIGHT (c) 1975,1976,1977,1978,1979,1980,1981,1982,
;			 1983,1984,1985,1986
;                    DIGITAL EQUIPMENT CORPORATION
;			 ALL RIGHTS RESERVED.
;
;     THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY  BE  USED
;     AND COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE
;     AND WITH THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.   THIS
;     SOFTWARE  OR ANY OTHER COPIES THEREOF MAY NOT BE PROVIDED OR
;     OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON.  NO  TITLE  TO
;     AND OWNERSHIP OF THE SOFTWARE IS HEREBY TRANSFERRED.
;
;     THE INFORMATION  IN  THIS  SOFTWARE  IS  SUBJECT  TO  CHANGE
;     WITHOUT  NOTICE  AND SHOULD NOT BE CONSTRUED AS A COMMITMENT
;     BY DIGITAL EQUIPMENT CORPORATION.
;
;     DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY
;     OF  ITS  SOFTWARE  ON  EQUIPMENT  WHICH  IS  NOT SUPPLIED BY
;     DIGITAL.
;

	SEARCH	SCNMAC
	SEARCH	ORNMAC
	SEARCH	GLXMAC
	SEARCH	QSRMAC
	SEARCH	UUOSYM

	.REQUE	REL:SCAN		;SYSTEM COMMAND SCANNER
	.REQUE	REL:WILD		;COMMON FILE-SYSTEM MANIPULATOR
	.REQUE	REL:HELPER		;SYSTEM HELP TEXT TYPER

;Version Information
;
	QUHVER==105			;MAJOR VERSION
	QUHMIN==0			;MINOR VERSION
	QUHWHO==0			;WHO LAST PATCHED
	QUHEDT==626			;EDIT NUMBER

	DEFINE VTITLE(VMA,VMI,VED,VWH),<
TITLE QUEUE - TOPS-10 Queue Entry and Change Program - CTKunkel - Version 'VMA'.'VMI'('VED')-'VWH'->

	IF1 <VTITLE \QUHVER,\QUHMIN,\QUHEDT,\QUHWHO>

	%%.QUH==VRSN.(QUH)

	LOC	137
	EXP	%%.QUH


	TWOSEG				;TWO SEGMENT PROGRAM
	RELOC	400000			;START IN HISEG

	SALL				;SUPPRESS MACRO EXPANSIONS

COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1971,1986.
ALL RIGHTS RESERVED.
\;END OF COPYRIGHT MACRO
SUBTTL Table of Contents

;               Table of Contents for QUEUE
;
;                        SECTION                                   PAGE
;
;    1. Copyright and Version Information.........................   1
;    2. Table of Contents.........................................   3
;    3. Revision History..........................................   4
;    4. QUEUE AC'S and I/O Channel Definitions....................   5
;    5. Symbols, Masks, and Flag Definitions......................   6
;    6. Parameters and Defaults...................................   8
;    7. Data Macros...............................................  11
;    8. Message Macros............................................  13
;    9. Device Macros.............................................  15
;   10. Entry and Initialization..................................  16
;   11. Main Processing Loop......................................  18
;   12. TSCAN  Routine Calls......................................  19
;   13. Command Scanning Default Routines.........................  22
;   14. Definition of Switch Accumulation Area and Default Values.  32
;   15. Default Switch Table Values...............................  33
;   16. File Scanning Error Messages..............................  34
;   17. Other Error Messages......................................  35
;   18. COMMND Command Processing.................................  36
;   19. NCREAT New CREATE Queue Request - Input or Output.........  38
;   20. CREATO New CREATE Output Queue Request....................  39
;   21. CREATI New CREATE Input Queue Request.....................  43
;   22. CRESND New CREATE Message Send Routine....................  47
;   23. NBLDEQ New Build EQ Block Routine (INP/OUT)...............  48
;   24. DOACCT Fill in the Accounting String......................  49
;   25. NLKFIL New Wild-Card LOOKUP Routine, Writes GALAXY Bits...  50
;   26. ISBIN  Check for Binary File Subroutine...................  58
;   27. NMODFY New MODIFY routine.................................  59
;   28. MODINP INPUT Specific Modification Routines...............  64
;   29. OUTPUT Specific Modification Routines.....................  66
;   30. GRPSTO Subroutine to Add a MODIFY Element to the Message..  68
;   31. NKILL New KILL routine....................................  69
;   32. NLIST  New LIST Routines..................................  70
;   33. NLSTBL Subroutine to Add Thing to LIST Message Block......  74
;   34. LSTOPN Listing routines - Open the listing file...........  75
;   35. LSTMTA Listing routines - Type out listing filespec.......  76
;   36. LSTHDR Listing routines - Header generation...............  78
;   37. LSTTYO Listing routines - Output the list answer..........  79
;   38. NDEFER New DEFER & ZDEFER Routine.........................  80
;   39. CMDXIT Return Routine.....................................  82
;   40. MSETUP Subroutine to Setup Temp and Message Areas.........  83
;   41. QUEFLS Subroutines to Flush the IPCF Receive Queue........  84
;   42. GQPID  Get the PID for QUASAR.............................  85
;   43. BLDACK Build ACK Code Subroutine..........................  86
;   44. GETOBJ Subroutine to Convert Device to an Object Type.....  87
;   45. MSGSND Subroutine to Send a Message to QUASAR.............  88
;   46. RCVACK Subroutine to Receive an Expected "ACK" from QUASAR  89
;   47. MAKNAM Subroutine to Make Up the Packet to Send to INFO...  91
;   48. DFDEST and DFPROC Routines................................  92
;   49. SETNOD Routine to Convert/Default a node Name/Number......  93
;   50. GCORE  Subroutine.........................................  94
;   51. General Subroutines.......................................  95
;   52. Command Scanning Subroutines..............................  97
;   53. QUETYP Identify What Type of QUEUE Has Been Specified..... 101
;   54. XPNQUE Expand QUEUE Name Abbreviation If Any.............. 103
;   55. ACCTSW Scan ACCOUNT Switch Processing Routine............. 104
;   56. RDX60W Input Time Subroutines............................. 105
;   57. Fatal Error Message Routines.............................. 106
;   58. Non-fatal Error Message Routines.......................... 107
;   59. Storage Description....................................... 108
;
SUBTTL Revision History

;600	QUENCH/QMANGR are a bit crufty, old MPB bits,
;	data formats, data structures, etc. Remove them
;	and add direct GALAXY interface. Include
;	/FONT and /GRAPHICS switches as part of the
;	laser printer support. Do this creating
;	new module QUEUE.MAC
;	15-Mar-85 /CTK
;
;601	Fix RDH SWITCH.INI file bug which clobbered
;	the S.ATTRIB word on LIST commands. Rewrite
;	the NLOKFL routine so we do varible length
;	FP blocks, cut down on /FONT switch overhead,
;	and rename NLOKFL to NLKFIL reflecting these
;	changes. Remove .FPINF/I.MOD word symbol crocks.
;	23-MAR-85 /CTK
;
;602	Fix Non-Existant batch control file CSG error message.
;	29-MAR-85 GCO 10184 /CTK
;
;603	Fix /FONT switch bugs and /STREAM or /UNIT in SWITCH.INI
;	on LIST command bug.
;	8-APR-84 GCO 10190 /CTK
;
;604	Make /BATLOG switch unique to one character.
;	Make multiply request output creates work and
;	give them all the same JOBNAME.
;	14-APR-85 GCO 101xx /CTK
;
;605	Move check for ACK code to after check for packet from IPCC,
;	otherwise can't use debugging feature.
;	18-Apr-85 GCO 10193 /JAD
;
;606	Init /ACCOUNT: switch storage to -1, not 0, DOACCT assumes
;	-1 means no account string supplied.
;	26-Apr-85 GCO 10200 /LWS
;
;607	Implement DQS support (internal use only).
;	4-Jun-85 GCO 10228 /JAD
;
;610	Bad AC in kill code prevents [1,2] job from killing requests.
;	13-Jun-85  GCO 10230  /DPM
;
;611	Finish rest of DQS support.
;	20-Jun-85  GCO 10236  /JAD
;
;612	Make QUEUE FOO/UNIT:LN01 work.
;		*** NOTE ***
;	Neither QUASAR nor QUEUE perform any validity checks
;	on the new unit class quantity.  This enables a customer
;	to write a spooler which passes the unit class info to
;	QUASAR with no modifications necessary to any part of
;	QUASAR or QUEUE.
;	 1-JUL-85  GCO 10240  /DPM
;
;613	Fix handling of /UNIT: for DQS printer.
;	9-Jul-85  GCO 102xx  /JAD
;
;614	Fix misleading messages beginning with "QMRxxx".  Remove
;	TTYCHR and TTYSTR macros and use OUTCHR/OUTSTR or N$xxxx
;	where appropriate.
;	16-Jul-85  GCO 10252  /JAD
;
;615	Fix .PRI LPTnnn: commands, QUEUE would HIBER.
;	18-Jul-85  GCO 10253 /CTK
;
;616	Fix /NULL stack phase error.
;	18-Jul-85  GCO 10254  /JAD
;
;617	Allow core limits larger than 256K.
;	22-Jul-85  GCO 10259  /DPM
;
;620	Add DMS (1022 database) and FIN ("FINE" editor buffer file)
;	to the binary extension table.
;	14-Nov-85  GCO 10327  /DPM
;
;621	We do not handle the "PRINT REL:FILE.EXT[,,EXAMPLE]"
;	command. When an ERSATZ device is part of the file spec
;	QUEUE can not find any SFD's on it.
;	SPR 10-34921	GCO 10126	3-DEC-84/CTK
;
;622	QUEUE/DEFER doesn't work.
;	13-Jan-86  GCO 10356  /DPM
;
;623	Make USERNAME an 8-bit ASCII field.
;	13-Feb-86 GCO 10377 /NT
;
;624	Get the log file in the right place if the device was not
;	explicitly specified.
;	17-Apr-86  GCO 10397  /JAD
;
;625	Remove old DQS support and replace with NQC equivalents.
;	Code still under the FTDQS feature test.
;	17-Jun-86  GCO 10418  /JAD
;
;626	Queue name string should be 8-bit ASCII.
;	18-Jun-86  GCO 10420  /JAD
SUBTTL	QUEUE AC'S and I/O Channel Definitions

	TF==0
	T1==1
	T2==2
	T3==3
	T4==4
	P1==5
	P2==6
	N==7				;NUMBER/NAME ...  USED BY SCAN
	C==10				;CHAR FROM CMD STRING (READ ONLY AC)
	I==11				;POINTS TO INPUT FILE SPEC
	F==12				;FLAGS (LH==PERMANENT, RH==TEMPORARY)
	J==13				;QUEUE TYPE JUMP FLAG
	FP==14				;FB'S FP BLOCK POINTER IN MESSAGE
	FD==15				;FB'S FD BLOCK POINTER IN MESSAGE
	M==16				;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
SUBTTL Symbols, Masks, and Flag Definitions

;PERMANENT FLAGS (LH)
;
	L.LOGI==(1B17)			;THIS JOB IS LOGGED IN
	L.NSBJ==(1B8)			;NOT LOGGED IN TOP LEVEL

;TEMPORARY FLAGS (RH)
;
	R.OUTL==1B30			;LISTING DEVICE NEEDS OUTPUT EACH LINE
	R.ANUL==1B27			;ALLOW DEVICE NUL:

;QUEUE LOCAL .FPINF SYMBOLS
;
	FP.DSP==7B24			;/DISPOSE: FIELD   -- LOCAL SYMBOL
		.FPPRE==1		;PRESERVE	   -- LOCAL SYMBOL
		.FPREN==2		;RENAME		   -- LOCAL SYMBOL
		.FPDEL==3		;DELETE		   -- LOCAL SYMBOL
	FP.OKB==1B25			;/ERBIN, /OKBIN	   -- LOCAL SYMBOL
	FP.NEW==1B26			;/NEW		   -- LOCAL SYMBOL
	FP.LOC==37B26			;FP LOCAL MASK	   -- LOCAL SYMBOL

;ACK CODE SYMBOLS
;
	ACK.NT==400000,,0		;Mask for /NOTIFY
	ACK.JB==377400,,0		;Mask for job number
	ACK.UT==377,,777777		;Mask for UDT bits

;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

;MODIFICATION INPUT DEPENDENCY SYMBOLS
;
	MI.DMT==3B19		;DEPENDENCY MODIFY TYPE
		.MIDAB==0	;ABSOLUTE
		.MIDPL==1	;PLUS (ADDITIVE)
		.MIDMI==2	;MINUS
		.MIDNM==3	;NO MODIFY
	MI.DEP==177777		;DEPENDENCY PARAMETER

;GENERAL SYMBOLS
;
	FBSIZE==FPXSIZ+FDXSIZ		;THE LARGEST FD/FP WE CAN BUILD
	MAX<FBSIZE,KIL.SZ,7,DFR.SZ>
	FBAREA==MAXSIZ			;THE LARGEST FILE BLOCK/MESSAGE NEEDED

	MX.PTH==.FXLEN
	PD.PTH==0
SUBTTL	Parameters and Defaults

;ASSEMBLY PARAMETERS
;

ND LN$PDL,100				;LENGTH OF PUSH-DOWN LIST
ND LN$ENT,11				;LENGTH OF A LOOKUP/ENTER BLOCK
ND LN$DSK,5				;LENGTH OF DSKCHR BLOCK

ND PUNCDP,0				;-1=NO PUNCH COMMAND
					;0=PUNCH COMMAND TO PTP
					;1=PUNCH COMMAND TO CDP
;DEFAULTS
;
	RADIX	^D10
DM AFT,  10080,   0,  10		;AFTER CURRENT TIME IN MINUTES
DM CDP,^O777777, 000,2000		;CARD PUNCH LIMIT IN CARDS
DM COP,     63,   1,   0		;NUMBER OF COPIES OF OUTPUT
DM COR, .INFIN,25600,40960		;CORE LIMIT FOR JOB
DM DPN,  65535,   0,   0		;INITIAL DEPENDENCY COUNT
DM LIM,^O777777,  00,   0		;OUTPUT LIMIT
DM LPT,^O777777,  00,2000		;LINE PRINT LIMIT IN PAGES
DM NOD,	77,0,0				;NODE NAME
DM NHD,      1,   1,   1		;FILE HEADERS ON OUTPUT
DM NTF,      1,   0,   1		;NOTIFY
DM PLT,^O777777,  00,  60		;PLOT LIMIT IN MINUTES
DM PRI,     63,SPLPRI,MXUPRI		;EXTERNAL PRIORITY
DM PTP,^O777777, 000, 100		;PT PUNCH LIMIT IN FEET
DM RID, ^O377777, 0,   0		;REQUEST ID
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
DM UNT,	7,0,0				;UNIT NUMBERS

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
;
;WHERE:
;	A	IS THE QUEUE NAME
;	B	MONITOR COMMAND FOR THE QUEUE

DEFINE QUEUES,<
	QQ	INP,<SUBMIT>
	QQ	LPT,<PRINT>
	QQ	CDP,<CPUNCH>
	QQ	PTP,<TPUNCH>
	QQ	PLT,<PLOT>
	QQ	PAT,<.PATCH>
>  ;END DEFINE QUEUES

;NOW INSURE THAT INP QUEUE IS FIRST AND DEFINE QUEUE TYPE SYMBOLS
;
DEFINE	QQ(A,B),<
	IFDIF	<A>,<INP>,<PRINTX  ?FIRST QUEUE MUST BE INP>
	..TMP==0
	QTP'A==..TMP
	DEFINE	QQ(Z,Y),<
		..TMP==..TMP+1
		QTP'Z==..TMP
	>  ;END REDEFINITION OF QQ
>  ;END DEFINE QQ

IF1,<	QUEUES	>
SUBTTL Data Macros

;MACRO TO MOVE DATA AROUND  -- WIPES TF
;
DEFINE	DATAM(SWRD,SFIELD,DWRD,DFIELD)<
	LOAD(TF,SWRD,SFIELD)
	XLIST
	STORE(TF,DWRD,DFIELD)
	LIST
	SALL
>  ;END OF DEFINE DATAM

;NMDCHG MACRO TO CHECK FILE BITS IN MODIFY.
;	SETS T1 = THE NEW VALUE OR -1 IF NO CHANGE
;
DEFINE	NMDCHG(FIELD),<
	MOVE	T1,I.MODM(I)
	XLIST
	TXNN	(T1,FIELD)
	  TDOA	T1,[-1]
	LOAD	(T1,I.MOD(I),FIELD)
	LIST
	SALL
>  ;END OF DEFINE NMDCHG

;MACRO TO MOVE A WORD DIRECTLY INTO THE MODIFY MESSAGE USING GRPSTO
;
DEFINE	MOVWRD(WORD),<
	MOVE	T1,WORD
	XLIST
	PUSHJ	P,GRPSTO
	LIST
	SALL
>  ;END OF DEFINE MOVWRD

;INCR MACRO
;
DEFINE	INCR(A,B),<AOS A>

DEFINE	SWSEG<
		XLIST
		LIT
		LIST
		RELOC
> ;END OF DEFINE SWSEG

;GCORE MACRO 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),<
	IFNDEF E.'A,<E.'A:>
	SKIPA
	XLIST
	JRST	%A
	JSP	T1,NFMSG'B
	SIXBIT	\   A\
	ASCIZ	\C\
%A:
	LIST
	SALL
>  ;END DEFINE N$FATE

DEFINE	N$WARN(A,B,C,%A),<
	IF1,<IFNDEF E.'A,<E.'A:>>
	SKIPA
	XLIST
	JRST	%A
	PUSHJ	P,FWARN'B
	<SIXBIT \A\>+[ASCIZ \C\]
%A:
	LIST
	SALL
>  ;END DEFINE N$WARN

DEFINE	N$INFO(A,B,C,%A),<
	IF1,<IFNDEF E.'A,<E.'A:>>
	SKIPA
	XLIST
	JRST	%A
	PUSHJ	P,FINFO'B
	<SIXBIT \A\>+[ASCIZ \C\]
%A:
	LIST
	SALL
>  ;END DEFINE N$INFO
;COMMANDS WHICH RUN QUEUE
;
DEFINE	QQ(A,B),<
	SIXBIT	/B/
>

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

PATCMD:	BLOCK	1			;PATCH COMMAND DISPATCH ADDRESS

;DEVICES USED BY THOSE COMMANDS
;
DEFINE	QQ(A,B),<
	SIXBIT	/A/
>

QDEVS:	SIXBIT	/LP/			;QUEUE COMMAND (MUST BE LP NOT LPT) 
IFG	PUNCDP,<SIXBIT /CDP/>
IFE	PUNCDP,<SIXBIT /PTP/>
IFL	PUNCDP,<>
	QUEUES

SUBTTL Device Macros

DEFINE DEVICE,<
	X	LPT,.OTLPT,LIQLPT
	X	LL,.OTLPT,LIQLPT
	X	LU,.OTLPT,LIQLPT
	X	PTP,.OTPTP,LIQPTP
	X	CDP,.OTCDP,LIQCDP
	X	PLT,.OTPLT,LIQPLT
	X	INP,.OTBAT,LIQBAT
>  ;END DEFINE DEVICE

DEFINE X(A,B,C),<
	SIXBIT	/A/
>  ;END DEFINE X
DEVTAB:	DEVICE
	NDEVS==.-DEVTAB

DEFINE X(A,B,C),<
	EXP	B
>  ;END DEFINE X
OBJTAB:	DEVICE

DEFINE X(A,B,C),<
	EXP	C
>  ;END DEFINE X
LIQTAB:	DEVICE

SUBTTL QUEUE Entry and Initialization

QUEUE:	PORTAL	.+2			;NORMAL ENTRY
	PORTAL	.+2			;CCL ENTRY
	TDZA	T1,T1			;ALLOW FOR CCL ENTRY POINT
	MOVEI	T1,1			;YES--FLAG CCL ENTRY
	MOVEM	T1,STRTOF		;SAVE FOR ISCAN
	RESET				;RESET ANY EXTERNAL I/O
	SETZM	F,ZCOR			;CLEAR FLAG, CLEAR CORE
	MOVE	T1,[ZCOR,,ZCOR+1]
	BLT	T1,EZCOR
	MOVE	P,[IOWD LN$PDL,PDLST]	;ESTABLISH PUSH-DOWN LIST
	PUSHJ	P,GTTABS		;DO ALL NECESSARY GETTABS
	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
	JRST	QUESS2			;YES--PROCEED
	TLO	F,L.NSBJ		;INDICATE NOT LOGGED IN	
	SETOM	T1			;START AT OUR JOB
QUESTL:	CTLJOB	T1,			;GET CONTROLLING NUMBER
	  JRST	QUESS2			;NONE--ASSUME OK ANYWAY
	JUMPL	T1,QUESS2		;IF NONE, ASSUME OK
	MOVN	T2,T1			;GET -JOB
	JOBSTS	T2,			;GET ITS STATUS
	  SETOM	T2			;ASSUME LOGGED IN
	TXNN	T2,JB.ULI		;SEE IF LOGGED IN
	JRST	QUESTL			;NO--LOOP ON UP CHAIN
	HRLZ	T2,T1			;GET THIS JOB'S NUMBER
	HRRI	T2,.GTPPN		;POINT TO PPN TABLE
	GETTAB	T2,			;GET PPN FROM MONITOR
	  JRST	QUESS2			;NONE!--GIVE UP
	MOVEM	T2,.MYPPN##		;OK--USE THAT INSTEAD
	TLZ	F,L.NSBJ		;OK AFTER ALL (PROBABLY OPSER CALL)

QUESS2:	MOVE	T1,.JBREL##		;SAVE CURRENT CORE
	HRL	T1,.JBFF##		;AND START OF FREE CORE
	MOVEM	T1,SAVCOR		;FOR LATER TO RESTORE
	MOVE	T1,[5,,[IOWD QCMLEN,QCOMS
			STRTOF,,'QUE'
			0,,0
			0,,0
			0,,0]	]
	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	QUELOP Main Processing Loop

;HERE WHENEVER * TYPED (IE, MAJOR RESTART)
;
QUELOP:	MOVE	T1,[10,,[IOWD SWTCHL,SWTCHN
			SWTCHD,,SWTCHM
			0,,SWTCHP
			'QUEUE '
			CLRANS,,CLRFIL
			INFIL,,OUTFIL
			FILSTK,,APLSTK
			CLRSTK,,0]  ]
	PUSHJ	P,.TSCAN##
	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,COMMND		;DO THE COMMAND
	JRST	QUELOP			;LOOP BACK FOR MORE WORK
SUBTTL	TSCAN  Routine Calls

;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	T2,I.MOD(T1)		;POINT TO OUR PART
	HRLI	T2,F.ZER		;POINT TO OUR F AREA
	BLT	T2,I.LZER(T1)		;COPY OUR PART
	MOVEI	T2,I.LZER		;AND PASS BLOCK LENGTH
	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
	HLRZM	T1,.JBFF##		;SET START OF FREE CORE
	HLRZM	T1,I.INZR		;ESTABLISH PARAMETER AREA HERE
	HLRZM	T1,I.NXZR		;AND OF ZERO LENGTH
	TLZ	T1,-1			;CLEAR JUNK
	CORE	T1,			;RESTORE REAL CORE ALSO
	  JFCL				;OK IF CAN'T
	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
	MOVEM	T1,P.STRT		; ..
	SETCM	T1,F.RPT		;MEMORIZE /REPORT
	JUMPE	T1,FILS.1		;DON'T STORE NULL REPORT
	DMOVE	T1,F.RPT		;GET /REPORT
	DMOVEM	T1,P.RPT		;AND SAVE IT
FILS.1:	MOVE	T1,[XWD F.FONT,P.FONT]	;MEMORIZE /FONT
	MOVE	T2,F.FONT		;GET /FONT
	CAME	T2,[-1]			;WAS IT SET ????
	BLT	T1,P.FONT+FNMLTH-1	;YES, MEMORIZE IT
	POPJ	P,			;AND RETURN

;HERE AT END OF SPECIFICATION TO APPLY USER SUPPLIED DEFAULTS
;
APLSTK:	MOVE	T1,P.MOD		;APPLY ALL FILE SWITCHES
	ANDCM	T1,F.MODM		;MASK 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,APLS.1		;NOW FOR THE FONT SWITCH
	SETCM	T1,F.RPT		;SKIP IF NO REPORT GIVEN
	JUMPN	T1,APLS.1		;DO THE FONT SWITCH
	DMOVE	T1,P.RPT		;GET /REPORT
	DMOVEM	T1,F.RPT		;SAVE IT
APLS.1:	MOVE	T2,[XWD P.FONT,F.FONT]	;PREPARE TO BLT STICKY FONT NAME
	MOVE	T1,F.FONT		;GET FILE SPECIFIC /FONT
	CAME	T1,[-1]			;WAS IT SET ????
	 POPJ	P,			;YES, DON'T USE STICKY
	MOVE	T1,P.FONT		;NO, GET STICKY /FONT
	CAME	T1,[-1]			;WAS IT SET ????
	BLT	T2,F.FONT+FNMLTH-1	;YES, APPLY IT
	POPJ	P,			;RETURN
SUBTTL DEFAUL	Command Scanning Default Routines

;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
	SKIPLE	S.CHK			;HAVE /CHECK ?
	SKIPL	S.LIST			;HAVE /LIST ?
	JRST	DEFAU0			;CONTINUE
	MOVEI	T2,LISTJOBS		;GET DEFAULT /LIST VALUE
	MOVEM	T2,S.LIST		;DEFAULT TO /LIST:JOBS
DEFAU0:	SKIPL	S.LIST			;SEE IF /LIST SHOWED UP
DEFAU1:	MOVEI	T1,.QORLS		;YES--FORCE /LIST AS DEFAULT
	SKIPGE	S.OPN
	MOVEM	T1,S.OPN
	SKIPLE	S.DFR			;WAS /DEFER SPECIFIED?
	POPJ	P,			;YES, RETURN NOW
	MOVE	T1,S.OPN		;FETCH ACTUAL OPERATION
	MOVE	T2,O.MODM		;GET INDICATOR OF OUTPUT
	CAIE	T1,.QORMD		;SEE IF /MODIFY
	CAIN	T1,.QORKL		;OR IF /KILL
	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:	SETZM	MADFIL			;CLEAR "MADE FILESPEC"
	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
	SETOM	MADFIL			;WE MADE A FILESPEC
	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 INP AND NOT LIST SEE IF GT 2 ENTRY
	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
	PUSH	P,S.ATTRIB		;SAVE /UNIT FOR LIST COMMANDS
	PUSH	P,S.UNTY		;DITTO
	CAIE	I,.QORMD		;IS IT MODIFY?
	CAIN	I,.QORKL		;OR KILL?
	  SOSA	CREFLG			;IT'S NOT CREATE!!
	PUSHJ	P,.OSCAN##		;LOOK AT OPTION FILE
	POP	P,T2			;GET UNIT TYPE BACK
	POP	P,T1			;GET POSSIBLE /UNIT VALUE BACK
	CAIN	I,.QORLS		;/LIST COMMAND ???
	DMOVEM	T1,S.ATTR		;YES, IGNORE .OSCAN'S /UNIT OR /STREAM
	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
	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:	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:	CAIE	I,.QORLS		;LISTING THE QUEUES?
	JRST	OUDF3A			;NO
	MOVE	P1,O.DEV		;GET OUTPUT DEVICE
	MOVX	T1,FX.PHY		;GET PHYSICAL FLAG
	SETZM	T2			;ASSUME NOT PHYSICAL
	TDNE	T1,O.MOD		;IS IT SET?
	MOVX	T2,UU.PHY		;YES
	DEVCHR	P1,(T2)			;GET DEVCHR WORD
	SKIPN	O.NAM			;HAVE A FILE NAME?
	TXNN	P1,DV.DIR		;A DIRECTORY DEVICE?
	JRST	OUDF3A			;NO NEED TO GENERATE A FILE NAME
	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
	SETOM	O.NAMM			;CLEAR MASK TO NO WILD-CARDS
OUDF3A:	HRLOI	T1,'LSQ'		;GET DEFAULT EXTENSION
	SKIPN	O.EXT			;ONE SPECIFIED?
	MOVEM	T1,O.EXT		;NO, USE THE DEFAULT

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:	SKIPLE	S.SEQ			;WAS /SEQ: SPECIFIED ??
	JRST	INDEF			;YES,,CONTINUE
	SKIPE	O.NAM			;WAS THERE A JOBNAME ??
	JRST	INDEF			;YES,,CONTINUE
	SKIPG	S.RID			;WAS /REQ: SPECIFIED ??
	N$FATE	<NSR>,,<Jobname or /SEQUENCE or /REQUESTID 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
	CAMN	T1,[-1]			;HAVE A TAG?
	SETZM	T1			;NO
	MOVEM	T1,I.STRT(I)		;STORE IT
	DMOVE	T1,I.RPT(I)		;GET /REPORT
	CAMN	T1,[-1]			;WAS IT SET?
	DMOVE	T1,F.RPT		;GET DEFAULT
	DMOVEM	T1,I.RPT(I)		;STORE IT
	MOVE	T1,I.FONT(I)		;GET /FONT
	CAME	T1,[-1]			;WAS IT SET ????
	 JRST	INDF1C			;YES, DON'T DEFAULT
	HRLI	T1,F.FONT		;NO, MOVE FONT SPEC
	HRRI	T1,I.FONT(I)		;GET DEFAULT
	BLT	T1,I.FONT+FNMLTH-1(I)	;MOVE IT AWAY
INDF1C:	MOVSI	T1,'DSK'		;DEFAULT TO DSK
	CAMN	I,I.INZR		;IS THIS THE FIRST SPEC?
	JRST	INDF1B			;NO,,SKIP THIS
	MOVE	T1,.FXDEV-I.LZER(I)	;NO, USE DEVICE FROM LAST SPEC
	JUMPN	J,INDF1B		;SKIP IF NOT INPUT QUEUE
	MOVEM	T1,PTHBLK+.PTFCN	;SAVE DEVICE IN PATH BLOCK
	MOVEI	TF,%EQONL		;LOAD OUTPUT NOLOG BIT
	MOVS	T2,.FXDEV(I)		;GET LOGFILE DEVICE
	CAIN	T2,'NUL'		;IS IT NUL:???
	MOVEM	TF,S.OUT		;YES, SET THE EXPLICIT BIT
	MOVE	T2,[.PTMAX,,PTHBLK]	;GET PATH ARG BLOCK
	PATH.	T2,			;GET INFO ABOUT THE DEVICE
	 JRST	INDF1B			;ASSUME WE ARE OK !!!
	MOVX	T2,PT.IPP		;SEE IF DEVICE IS ERSATZ
	TDNN	T2,PTHBLK+.PTSWT	;IS IT ???
	JRST	INDF1B			;NO,,SKIP THIS
	MOVSI	T1,'DSK'		;YES,,DEFAULT TO DSK

INDF1B:	JUMPGE	J,INDF1A		;JUMP IF NOT /LIST
	MOVE	T1,DQTYPE		;GET DEFAULT QUEUE
	TLNN	T1,(77B17)		;IS IT FROM QUEUE COMMAND?
	SETZM	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
	HLLOS	.FXEXT(I)		;SET FULL MASK
	JUMPN	J,INDEFY		;JUMP IF NOT INPUT
	HRLOI	T1,'CTL'		;LOAD THE EXTENSION
	CAMN	I,I.INZR		;SEE IF FIRST FILE
	JRST	INDEF2			;YES--PROCEED BELOW
	HRLOI	T1,'LOG'		;  CHANGE TO LOG
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:	MOVE	T2,.MYPPN##		;GET MY PPN
	TDNE	T1,.FXMOM(I)		;SEE IF USER SPECIFIED DIRECTORY
	 JRST	INDFTU			;YES--DEFAULT [,] FROM MY PPN
	SKIPE	T2,O.DIR		;ACTION REQUEST--SEE IF
	CAMN	T2,.MYPPN##		;  FOR SPECIFIC USER
	JRST	INDEFD			;NO--PROCEED
INDFTU:	MOVE	T3,.FXDEV(I)		;GET DEVICE
	MOVEM	T3,PTHBLK+.PTFCN	;STORE FOR PATH. UUO
	MOVE	T3,[.PTMAX,,PTHBLK]	;SET UP THE UUO
	PATH.	T3,			;GET THE BITS
	  SETZM	PTHBLK+.PTSWT		;FAILURE, NOT ERSATZ
	MOVE	T3,PTHBLK+.PTSWT	;GET THE BITS
	TXNN	T3,PT.IPP		;IMPLIED PPN ???
	  JRST	INDFU1			;NO, DEFAULT THE PPN
	MOVE	T1,PTHBLK+.PTPPN	;YES, GET THE PPN
	SKIPN	.FXDIR(I)		;DID WE SPECIFY ANY ???
	MOVEM	T1,.FXDIR(I)		;YES, STORE IT
	SETOM	.FXDIM(I)		;NO, AND IT'S  NOT WILD ANY MORE
	  JRST	INDEFD			;SET UP DIRECTORY NOW
INDFU1:	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
	INCR	T2			;ADVANCE COUNT
	AOBJN	T2,INDFNN		;LOOP OVER SFD DEPTH
INDEF4:	MOVE	T1,INDADS		;ABSENT DEFAULTS FOR SWITCHES
	JUMPN	J,INDEFO		;JUMP IF NOT INPUT
	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
	IORM	T1,I.MOD(I)		;AND INCLUDE

INDNOK:	LOAD	T1,I.MOD(I),FP.FPF	;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
	STORE	T1,I.MOD(I),FP.FPF	;AND STORE IT

	MOVEI	T1,AD.STR		;GET DEFAULT STARTING POINT
	SKIPE	CREFLG			;SEE IF /MODIFY
	SETOM	T1			;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:	SKIPE	T1,S.JOB		;GET REQUESTED JOB NAME
					;(IF THERE IS ONE)
	CAMN	T1,[-1]			;IF ITS -1,,DONT SAVE IT
	SKIPA				;0 OR -1,,SKIP 
	MOVEM	T1,O.NAM		;SAVE IT FOR LATER
	SKIPGE	S.SEQ			;SEE IF SEQUENCE STILL NOT SET
	SETZM	S.SEQ			; RIGHT--SET IT FOR /MOD/KILL

	SKIPLE	T1,S.COR		;/CORE SPECIFIED ?
	JRST	SWDF2A			;YES,,ADJUST IT
	SKIPN	CREFLG			;/MODIFY ???
	SETZM	S.COR			;NO,,ASSUME DEFAULT
	JRST	SWDF2B			;AND SKIP REST
SWDF2A:	CAIGE	T1,^D256		;SEE IF ALREADY IN WORDS
	LSH	T1,^D10			;NO--ADD K FACTOR
	MOVEM	T1,S.COR		;STORE RESULT

SWDF2B:	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
	INCR	T2			;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 (12)0 (6)SPACSI (2)0 (1)AD.NHD (6)0 (9)AD.COP ;DEF. FILE SWITCHES
INDADI:	<BYTE (6)FILEAS (6)0 (6)SPACSI (1)AD.LFD (8)0 (9)AD.COP>+FP.FLG+FP.NEW+AD.NHD  ;INPUT QUEUE LOG FILE

SUBTTL Definition of Switch Accumulation Area and Default Values

;EACH ENTRY IN QSM MACRO IS:
;	SMX	SWITCH-LOCATION,DEFAULT
;
DEFINE QSM,<
	SMX	S.ACCT,-1
	MSC	7			;SEVEN MORE - TOTAL OF EIGHT
	SMX	S.AFT,0
	SMX	S.ALLF,-1
	SMX	S.ASST,ASSTYES
;*** S.ATTR AND S.UNTY MUST BE ADJACENT ***
	SMX	S.ATTR,-1		;ATTRIBUTES
	SMX	S.UNTY,-1		;UNIT TYPE
	SMX	S.BATL,BATLAPPEND
	SMX	S.BATO,-1
IFN FTDQS,<
	SMX	S.CHAR,0
	MSC	CHRSIZ-1
>; END IFN FTDQS
	SMX	S.CHK,-1
	SMX	S.COR,-1
	SMX	S.DFR,-1
	SMX	S.DEST,-1
	SMX	S.DIST,-1
	MSC	7
	SMX	S.DPN,0
	SMX	S.FRM,0
IFN FTDQS,<
	MSC	FRMSIZ-1		;A FEW MORE WORDS
>; END IFN FTDQS
	SMX	S.JOB,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.LPAT,0		;PATCH LIMIT
	SMX	S.LTIM,0
	SMX	S.NOS1,0
	SMX	S.NOS2,0
	SMX	S.NTF,-1
	SMX	S.NULL,0
	SMX	S.OPN,0
	SMX	S.OUT,-1
	SMX	S.PRI,-1
	SMX	S.PROC,-1
IFN FTDQS,<
	SMX	S.QNM,0
	MSC	QNMLEN-1
>; END IFN FTDQS
	SMX	S.RSTR,AD.RST
	SMX	S.RDR,-1
IFN FTDQS,<
	SMX	S.RMT,-1
>; END IFN FTDQS
	SMX	S.RID,0
	SMX	S.SEQ,0
	SMX	S.SPAC,-1
	SMX	S.UNIQ,-1
	SMX	S.USER,-1
	MSC	7
>  ;END DEFINE QSM

DEFINE	MSC(A)<
	BLOCK	A
>

	S.LINP==0			;DUMMY
	S.NOT==S.NOS1
SUBTTL Default Switch Table Values

;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

;LOCATIONS OF INDIVIDUAL QUEUE LIMITS
DEFINE QQ(A,B),<
	EXP	S.L'A
>
SWLDT:	QUEUES

	SALL
SUBTTL File Scanning Error Messages

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 Other Error Messages

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
E.NFLS:	SKIPLE	S.NULL			;NO FILES--SEE IF MESSAGE SUPPRESSED
	PJRST	CMDXIT			;YES--JUST QUIT
	N$FATE	<NFI>,,<No files in request>
E.ICMD:	HRRZ	N,I
	N$FATE	<ICC>,<D>,<Improper command code>
E.NOQS:	N$FATE	<NQS>,,<No queue specified>
E.SVTL:	N$FATE	<SVT>,<D>,<Switch value too large>
E.IQNN:	MOVE	N,O.DEV			;GET THE DEVICE
E.IQN:	N$FATE	<IQN>,<N>,<Illegal queue name>
SUBTTL	COMMND Command Processing

;COMMND -- SUBROUTINE TO PROCESS COMMAND
;USES EVERYTHING
;HERE AFTER COMMAND HAS BEEN DECODED AND ALL DEFAULTS SUPPLIED
;DISPATCH TO APPROPRIATE COMMAND PROCESSOR
;
COMMND:	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	T1,COMDEV		;GET THE DEVICE BACK
	MOVEM	T1,DQTYPE		;  AND RESTORE IT (ZAP'D BY ABOVE BLT)
	MOVS	T1,COMDEV		;GET DEVICE NAME IN RH
	CAIN	T1,'PAT'		;PATCHING?
	SKIPA	T1,PATCMD		;YES
	MOVE	T1,CDTAB-1(I)		;GET ADDRESS AND CONTROL BITS
	SKIPLE	S.DFR			;WAS /DEFER SPECIFIED?
	HRRI	T1,NDEFER		;YES, DISPATCH TO DEFER ROUTINE
	TLNE	T1,(NNLGSB)		;SEE IF ERROR AS SUBJOB
	TLNN	F,L.NSBJ		;NO--SEE IF TOP IS LOGGED IN
	SKIPA				;YES--LEAVE ALONE
	TLO	T1,(NNLGI)		;NO--INDICATE ERROR
	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

CDTAB:
	EXP	NCREAT+NNLGI		;1=CREATE ENTRY
	EXP	0			;2 WAS /DEFER
	EXP	0			;3 WAS /ZDEFER
	EXP	NLIST			;4=LIST QUEUE
	EXP	NMODFY+NNLGSB		;5=MODIFY EXISTING ENTRY
	EXP	NKILL+NNLGSB		;6=KILL EXISTING ENTRY
LCDT==.-CDTAB

CMDTAB:	SIXBIT	/CREATE/
	EXP	0,0
	SIXBIT	/LIST/
	SIXBIT	/MODIFY/
	SIXBIT	/KILL/
SUBTTL	NCREAT New CREATE Queue Request - Input or Output

NCREAT:	MOVNI	T1,I.LZER		;COMPUTE START
	ADD	T1,I.NXZR		;OF LAST SPEC
	MOVEM	T1,I.LSZR		;FOR WILD

;SET UP THE MESSAGE AREA
;
	PUSH	P,.JBFF##		;SAVE ORIGINAL .JBFF
	PUSHJ	P,MSETUP		;GET MEMORY ETC FOR MESSAGE

;CREATE MESSAGE HEADER
;
	MOVX	T1,EQHSIZ		;SIZE WITH PATH
	STORE	T1,.EQLEN(M),EQ.LOH	;STORE LENGTH OF REQUEST HEADER
	STORE	T1,.MSTYP(M),MS.CNT	;AND AS INITIAL MESSAGE LENGTH
	MOVX	T1,.QOCRE		;FUNCTION CREATE
	STORE	T1,.MSTYP(M),MS.TYP	;AS MESSAGE TYPE
	JUMPE	J,CREATI		;IF INPUT QUEUE, GO DO IT
	JRST	CREATO			;NO, MUST BE OUTPUT QUEUE
SUBTTL CREATO New CREATE Output Queue Request

;BEGINNING OUT ROB BLOCK CODE
;OUT ROB OBJECT TYPE WORD CODE
;
CREATO:	PUSHJ	P,GETOBJ		;FIND THE OBJECT
	STORE	T3,.EQROB+.ROBTY(M)	;STORE OBJECT TYPE

;OUT ROB ATTRIBUTE WORD CODE
;
	HLRZ	T1,O.DEV		;GET THE DEVICE BACK
	MOVEI	T2,0			;GET SOME ATTRIBUTES
	CAIN	T1,'LL '		;IS IT LL?
	MOVX	T2,%LOWER		;YES,,LOAD LOWER CASE
	CAIN	T1,'LU '		;OR LU?
	MOVX	T2,%UPPER		;YES,,LOAD UPPER CASE
	STORE	T2,.EQROB+.ROBAT(M),RO.ATR ;STORE IT

;OUT ROB UNIT WORD CODE (MPB)
;MAY OVER WRITE ATTRIBUTE WORD
;
	HRRZ	T3,O.DEV		;GET DEVICE ONCE MORE
	JUMPE	T3,CREO.1		;MPB FORMAT FIELD ???
	LDB	T2,[POINT 6,T3,23]	;YES, GET 4TH DIGIT
	CAIN	T2,'S'			;STATION SPECIFICATION?
	 JRST	CREO.1			;YES, NO MPB UNIT VALUE
	LDB	T1,[POINT 6,T3,35]	;GET THE 6TH CHAR
	TXNN	T3,7700			;IS THERE A NODE FIELD?
	LDB	T1,[POINT 6,T3,23]	;NO, GET 4TH DIGIT
	JUMPE	T1,CREO.1		;GO IF NO UNIT
	SUBI	T1,'0'			;ELSE, GET A UNIT
	TXO	T1,RO.PHY		;SET PHYSICAL UNIT BIT
	STORE	T1,.EQROB+.ROBAT(M)	;AND STORE UNIT NUMBER

;OUT ROB /LOWER, /UPPER, AND /UNIT SWITCH CODE (GALAXY)
;MAY OVER WRITE ATTRIBUTE WORD
;
CREO.1:	DMOVE	T1,S.ATTR		;GET ATTRIBUTES
	CAME	T1,[-1]			;GALAXY ATTRIBUTE SWITCH ???
	MOVEM	T1,.EQROB+.ROBAT(M)	;YES, STORE /UNIT IN MESSAGE
	CAME	T2,[-1]			;UNIT TYPE?
	MOVEM	T2,.EQROB+.ROBUT(M)	;YES

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;OUT ROB NODE WORD CODE GALAXY /DEST AND MPB
;
	HRROI	T4,.GTLOC		;SETUP TO GET MY LOCATION
	GETTAB	T4,			;GET IT
	  MOVEI	T4,0			;LOSE
	HRRZ	T3,O.DEV		;GET DEVICE ONCE MORE
	JUMPE	T3,CREO.2		;MPB FORMAT FIELD ???
	TRNN	T3,007777		;YES, WAS UNIT ALONE SPECIFIED ???
	  JRST	CREO.2			;YES, SKIP THIS STUFF
	LDB	T1,[POINT 6,T3,23]	;NO, GET THE 4TH DIGIT
	CAIN	T1,'S'			;STATION SPECIFICATION?
	 JRST	[LSH	T3,6		;YES--SHIFT IT OFF
		 TLZ	T3,-1		;CLEAR OVERFLOW
		 LDB	T1,[POINT 6,T3,23];GET FIRST NODE DIGIT
		 JRST	.+1]		;AND PROCEED
	CAIL	T1,'0'			;MUST BE NUMERIC
	CAILE	T1,'7'			;AND IN RANGE
	 JRST	E.IQNN			;ELSE SAY ILLEGAL QUEUE
	LDB	T2,[POINT 6,T3,29]	;GET THE 5TH DIGIT
	CAIL	T2,'0'			;MUST BE NUMERIC
	CAILE	T2,'7'			;AND IN RANGE
	 JRST	E.IQNN			;ELSE SAY ILLEGAL QUEUE
	SUBI	T1,'0'			;MAKE IT BINARY
	SUBI	T2,'0'			;BOTH OF THEM
	IMULI	T1,10			;AND START BUILDING AN OCTAL NUMBER
	ADD	T1,T2			;FINISH THE PROCESS
	SKIPA				;USE MPB NODE INFO
CREO.2:	MOVE	T1,T4			;GET THE DEFAULT
	MOVE	T2,S.DEST		;GET THE /DESTINATION NODE
	CAMN	T2,[-1]			;DID WE TYPE IT ???
	  JRST	CREO.3			;NO, STORE IN MESSAGE 
	MOVE	T1,S.DEST		;GET THE /DESTINATION NODE
	PUSHJ	P,SETNODE		;CONVERT/DEFAULT THE NODE NAME/NUMBER
	CAMN	T1,[-1]			;SEE IF NO NETWORK SOFTWARE
	SETZM	T1			;YES--MAKE THE NODE NUMBER 0
CREO.3:	STORE	T1,.EQROB+.ROBND(M)	;STORE IT

;END OF OUT ROB BLOCK CODE
;BUILD EQ BLOCK
;
	PUSHJ	P,NBLDEQ		;GO BUILD THE EQ BLOCK

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;BEGINNING OF LIMIT WORD CODE
;LIMIT WORD # 0
;
	MOVE	T1,S.FRM		;GET THE FORMS TYPE
	STOLIM	T1,.EQLIM(M),FORM	;PUT IT IN THE OUTPUT BLOCK

;LIMIT WORD # 1
;
	SKIPG	T1,S.LIM		;IS IT A REASONABLE LIMIT
	SETZM	T1			;NO, INSURE ZERO
	SKIPLE	S.SPAC			;DO WE HAVE ABNORMAL SPACING ???
	 IMUL	T1,S.SPAC		;YES, MULTIPLY THE LIMIT BY IT
	CAILE	T1,777776		;CHECK TO LARGE
	MOVEI	T1,777776		;FORCE OK
	STOLIM	T1,.EQLIM(M),OLIM	;STORE IN SECOND LIMIT WORD

;LIMIT WORDS # 2 AND 3
;
	MOVE	T1,S.NOS1		;GET /NOTE SWITCH
	STOLIM	T1,.EQLIM(M),NOT1	;STORE IN THIRD LIMIT WORD
	MOVE	T1,S.NOS2		;GET /NOTE SWITCH
	STOLIM	T1,.EQLIM(M),NOT2	;STORE IN FOURTH LIMIT WORD

;END OF LIMIT WORD CODE
;

IFN FTDQS,<

;QUEUE NAME
;
	SKIPN	S.QNM			;/QUEUE SPECIFIED?
	JRST	CREO.8			;NO
	MOVSI	T1,S.QNM		;WHERE /QUEUE IS STORED
	HRRI	T1,.EQQNM(M)		;WHERE TO PUT IT
	BLT	T1,.EQCHR+QNMLEN-1(M)	;COPY TO EQ

;CHARACTERISTICS
;
CREO.8:	SKIPN	S.CHAR			;/CHARACTERISTICS SPECIFIED?
	JRST	CREO.9			;NO
	MOVSI	T1,S.CHAR		;WHERE /CHARACTERISTICS IS STORED
	HRRI	T1,.EQCHR(M)		;WHERE TO PUT IT
	BLT	T1,.EQCHR+CHRSIZ-1(M)	;COPY TO EQ

;LONG FORMS NAME
;
CREO.9:	MOVSI	T1,S.FRM		;WHERE /FORMS IS STORED
	HRRI	T1,.EQFRM(M)		;WHERE TO PUT IT
	SKIPE	S.FRM			;DON'T COPY IF NOT SPECIFIED
	BLT	T1,.EQFRM+FRMSIZ-1(M)	;COPY TO EQ
>; END IFN FTDQS

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;HERE TO ADD FB BLOCKS TO EQ REQUEST
;
	SETZM	I			;YES, SETUP CALL TO NLKFIL
CREO.4:	LOAD	T1,.MSTYP(M),MS.CNT	;CHECK FOR PAGE OVERFLOW
	ADDI	T1,FBSIZE		;SIZE IF I INCLUDE THIS FILE
	CAILE	T1,PAGSIZ		;OVER A PAGE BOUNDRY
	 PUSHJ	P,CREO.6		;YES, START A NEW MESSAGE
	LOAD	FP,.MSTYP(M),MS.CNT	;GET CURRENT SIZE
	ADDI	FP,(M)			;FP = FILE BLOCK LOCATION IN REQUEST
	PUSHJ	P,NLKFIL		;CREATE THE GALAXY FB BLOCK
	 JRST	CREO.5			;SEND THE MESSAGE
	INCR	.EQSPC(M),EQ.NUM	;BUMP NR. FILES IN REQUEST
	CLOSE	DC,CL.NMB		;KEEP ACCESS TABLE IN CORE
	RELEASE	DC,			;RELEASE THE CHANNEL
	 JRST	CREO.4			;GET ANOTHER GALAXY FB BLOCK

CREO.5:	LOAD	T1,.EQSPC(M),EQ.NUM	;GET NUMBER FILES IN REQUEST
	JUMPG	T1,CRESND		;ARE THERE FILE IN REQUEST ???
	DECR	NUMANS			;NO FILES IN THIS REQUEST
	MOVE	T1,NUMANS		;GET THE NEW REQUEST COUNT
	JUMPG	T1,CRESND		;ANY FULL REQUESTS TO DISPATCH ???
	JRST	E.NFLS			;NO FILES OR REQUESTS TO SEND

;ROUTINE TO BUILD ADDITIONAL REQUESTS
;COPY EQ HEADER, ROB, ETC.
;
CREO.6:	PUSH	P,M			;SAVE CURRENT REQUEST ADDR
	PUSHJ	P,MSUP.1		;GET MEMORY ETC FOR NEW REQUEST
	POP	P,T1			;RESTORE OLD REQUEST ADDR BACK
	HRLI	T2,(T1)			;LOAD OLD REQUEST ADDR FOR BLT
	HRRI	T2,(M)			;AND NEW REQUEST ADDR
	BLT	T2,EQHSIZ-1(M)		;BLT OLD EQ, ROB, ETC. TO NEW REQUEST

;LET'S FIX UP THE JOBNAME
;
	MOVEI	T2,EQHSIZ(T1)		;GET ADDR OF OLD MSG FST FB BLK
	LOAD	T3,.FPLEN(T2),FP.LEN	;GET FP BLOCK SIZE
	ADD	T2,T3			;POINT TO FD BLOCK
	MOVE	T3,.EQJOB(T1)		;GET THE JOBNAME
	SKIPN	T3			;USER SPECIFY JOBNAME ???
	MOVE	T3,.FDNAM(T2)		;GET FIRST FILE NAME IN FIRST MSG
	MOVEM	T3,.EQJOB(T1)		;PUT JOBNAME BACK IN ORIGINAL MSG
	MOVEM	T3,.EQJOB(M)		;AND STORE JOBNAME IN NEW REQUEST

;RESET LENGTH OF REQUEST
;
	MOVX	T1,EQHSIZ		;SIZE WITH PATH
	STORE	T1,.EQLEN(M),EQ.LOH	;STORE LENGTH OF REQUEST HEADER
	STORE	T1,.MSTYP(M),MS.CNT	;AND AS INITIAL MESSAGE LENGTH

;RESET NUMBER OF FILES IN REQUEST
;
	SETZM	T1			;GET READY TO
	STORE	T1,.EQSPC(M),EQ.NUM	;ZERO NUMBER FILES IN REQUEST
	POPJ	P,			;BACK TO THE FB BLOCKS
SUBTTL CREATI New CREATE Input Queue Request

;BEGINNING INP ROB BLOCK CODE
;
CREATI:	PUSHJ	P,GETOBJ		;FIND THE OBJECT
	STORE	T3,.EQROB+.ROBTY(M)	;STORE OBJECT TYPE
	PUSHJ	P,DFPROC		;DEFAULT /PROC IF NOT GIVEN
	MOVE	T1,S.PROC		;LOAD /PROC
	PUSHJ	P,SETNODE		;CONVERT IT
	CAMN	T1,[-1]			;MONITOR SUPPORT NETWORK ???
	SETZM	T1			;YES,,MAKE THE NODE NUMBER 0
	MOVEM	T1,.EQROB+.ROBND(M)	;SAVE IT IN THE ROB
	LOAD	T1,S.ATTRIB,RO.ATR	;GET ATTRIBUTES
	CAXE	T1,%SITGO		;IS IT SITGO ???
	MOVX	T1,%GENRC		;NO, MUST BE GENRIC
	STORE	T1,.EQROB+.ROBAT(M),RO.ATR	;SAVE THE ATTRIBUTE
	SETZM	.EQROB+.ROBUT(M)	;UNIT TYPE IS MEANINGLESS FOR INPUT

;END OF INP ROB BLOCK CODE
;BUILD EQ BLOCK
;
	PUSHJ	P,NBLDEQ		;GO BUILD THE EQ BLOCK

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;BEGINNING OF LIMIT WORD CODE
;LIMIT WORD # 0
;
	SKIPL	T1,S.UNIQ		;/UNIQUE SWITCH ???
	JRST	CREI.1			;YES, PROCESS THE SWITCH
	SETZM	T1			;ZERO THE UNIQUE BITS
	JRST	CREI.2			;GO SAVE THE /UNIQUE VALUE
CREI.1:	CAIG	T1,2			;WAS IT :0 OR :NO ???
	MOVEI	T1,%EQUNO		;MAKE IT :NO
	CAILE	T1,2			;OR WAS IT :1 OR :YES ???
	MOVEI	T1,%EQUYE		;MAKE IT :YES
CREI.2:	STOLIM	T1,.EQLIM(M),UNIQ	;AND STORE AWAY
	SETZM	T1
	STOLIM	T1,.EQLIM(M),BSPR	;CLEAR SPARE BITS
	MOVX	T1,%EQRNO		;ASSUME /REST:NO
	SKIPE	S.RSTR			;IS IT /REST:NO ???
	MOVX	T1,%EQRYE		;NO, SO IT'S /REST:YES
	STOLIM	T1,.EQLIM(M),REST	;AND STORE IT
	SKIPGE	T1,S.OUT		;GET OUTPUT QUEUEING
	MOVEI	T1,INPLOG		;DEFAULT TO /OUTPUT:LOG
	STOLIM	T1,.EQLIM(M),OUTP	;AND STORE THE VALUE
	HRRZ	T1,S.DPN		;GET DEPENDENCY REQUEST
	TRZ	T1,MI.DMT		;CLEAR +- FLAGS
	STOLIM	T1,.EQLIM(M),DEPN	;STORE /DEPENDENCY SWITCH
	MOVE	T1,S.ASST		;/ASSIST SPECIFIED ???
	STOLIM	T1,.EQLIM(M),OINT	;STORE IT AWAY

;LIMIT WORD # 1
;
	SKIPLE	T1,S.COR		;/CORE SPECIFIED ?
	JRST	CREI.3			;YES,,ADJUST IT
	SETZM	T1			;NO,,ASSUME DEFAULT
	JRST	CREI.4			;AND SKIP REST
CREI.3:	CAIGE	T1,^D256		;SEE IF ALREADY IN WORDS
	LSH	T1,^D10			;NO--ADD K FACTOR
	ADDI	T1,PAGSIZ-1		;ROUND UP TO A PAGE BOUNDRY
	ADR2PG	T1			;CONVERT TO PAGES
CREI.4:	STOLIM	T1,.EQLIM(M),CORE	;STORE /CORE:pages
	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
	STOLIM	T1,.EQLIM(M),TIME	;STORE /TIME:seconds

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;LIMIT WORD # 2
;
	MOVE	T1,S.LLPT		;FETCH PAGE LIMIT
	STOLIM	T1,.EQLIM(M),SLPT	;STORE SPOOLED LPT LIMIT
	MOVE	T1,S.LCDP		;FETCH CARD PUNCH LIMIT
	STOLIM	T1,.EQLIM(M),SCDP	;STORE SPOOLED CDP LIMIT

;LIMIT WORD # 3
;
	MOVE	T1,S.LPTP		;FETCH PAPER TAPE LIMIT
	STOLIM	T1,.EQLIM(M),SPTP	;STORE SPOOLED PTP LIMIT
	MOVE	T1,S.LPLT		;FETCH PLOT LIMIT
	STOLIM	T1,.EQLIM(M),SPLT	;STORE SPOOLED PLT LIMIT

;LIMIT WORD # 4
;
	HRRZ	T1,O.DEV		;CHECK FOR MPB INPnn: OR INPSnn:
	JUMPE	T1,CREI.5		;WELL, DO WE HAVE ONE ???
	TRNN	T1,007777		;YES, DID THEY SPECIFY A UNIT ???
	  JRST	CREI.5			;YES, IGNORE IT
	SETZM	S.DEST			;CLEAR THE DEST NODE WORD
	LDB	T2,[POINT 6,T1,23]	;GET THE FIRST NODE CHARACTER
	CAIN	T2,'S'			;STATION SPECIFIED ???
	  JRST	[LSH	T1,6		;YES, SO SHIFT IT OFF
		 TLZ	T1,-1		;CLEAR ANY OVERFLOW
		 LDB	T2,[POINT 6,T1,23];GET NODE CHARACTER AGAIN
		 JRST	.+1]		;FALL BACK INTO MAIN CODE
	CAIL	T2,'0'			;NO, IS IT NUMERIC
	CAILE	T2,'7'			;AND THE RANGE VALID ???
	  JRST	E.IQNN			;NO, GIVE AN ERROR MESSAGE
	DPB	T2,[POINT 6,S.DEST,5]	;YES, STORE THE BITE
	LDB	T2,[POINT 6,T1,29]	;GET SECOND CHARACTER
	CAIL	T2,'0'			;NO, IS IT NUMERIC
	CAILE	T2,'7'			;AND THE RANGE VALID ???
	  JRST	E.IQNN			;NO, GIVE AN ERROR MESSAGE
	DPB	T2,[POINT 6,S.DEST,11]	;YES, STORE THE BITE
CREI.5:	PUSHJ	P,DFDEST		;DEFAULT /DESTINATION IF NOT GIVEN
	MOVE	T1,S.DEST		;LOAD /DESTINATION
	PUSHJ	P,SETNODE		;CONVERT IT
	CAMN	T1,[-1]			;NO NETWORK SUPPORT IN THIS MONITOR ???
	SETZM	T1			;YES,,MAKE THE NODE NUMBER 0
	STOLIM	T1,.EQLIM(M),ONOD	;AND STORE AWAY

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;LIMIT WORD # 5
;
	MOVE	T1,S.BATL		;GET THE LOG FILE TYPE CODE
	STOLIM	T1,.EQLIM(M),BLOG	;AND STORE AWAY
	SKIPE	T1,MADFIL		;GET THE 'MADE A FILE' FLAG
	STOLIM	T1,.EQLIM(M),DLOG	;SET DEFAULT LOG BIT

;LIMIT WORD # 6
;
	MOVE	T1,S.BATO		;GET /BATOPT
	CAME	T1,[EXP -1]		;SPECIFIED ???
	STOLIM	T1,.EQLIM(M),OPTN	;YES, STORE IT IN MESSAGE

;END OF LIMIT WORD CODE
;

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;BEGINNING PATH BLOCK CODE
;
	MOVSI	T1,-.FXLND		;SET FOR FULL LOOP COUNT
	HRRI	T1,(M)			;POINT TO REQUEST
	MOVEI	T2,0			;INITIALIZE FETCH POINTER
CREI.6:	SKIPE	T3,DEFDIR(T2)		;GET /PATH:
	ADDI	T2,2			;ADVANCE FETCH UNLESS AT END
	MOVEM	T3,.EQPAT(T1)		;STORE IN REQUEST
	AOBJN	T1,CREI.6		;LOOP UNTIL DONE

;END OF PATH BLOCK CODE
;

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;HERE TO ADD FB BLOCKS TO EQ REQUEST
;
	SETZM	I			;SETUP CALL TO NLKFIL
CREI.8:	LOAD	FP,.MSTYP(M),MS.CNT	;GET CURRENT SIZE
	ADDI	FP,(M)			;FP = FILE BLOCK LOCATION IN REQUEST
	PUSHJ	P,NLKFIL		;CREATE THE GALAXY FB BLOCK
	  JRST	CREI.9			;SEND THE MESSAGE
	INCR	.EQSPC(M),EQ.NUM	;BUMP NR. FILES IN REQUEST
	TXO	F,R.ANUL		;ALLOW NUL: FOR LOGFILE
	JRST	CREI.8			;GET ANOTHER GALAXY FB BLOCK

CREI.9:	HLLZS	F			;RESET LOG FILE FLAG
	LOAD	T1,.EQSPC(M),EQ.NUM	;GET NUMBER FILES IN REQUEST
	CAIE	T1,2			;SEE IF EXACTLY TWO FILES
	N$FATE <INF>,,<Incorrect number of files in input queue request>;NO
	  JRST	CRESND			;DO THE SEND

SUBTTL	CRESND New CREATE Message Send Routine

CRESND:	SKIPN	NUMANS			;ALL SENT YET
	  JRST	CMDXIT			;YES, RETURN TO CALLER
	JUMPE	J,CSND.1		;NO, IF INPUT QUEUE, GO DO IT
	MOVE	T1,NOBLKS		;GET COUNT OF BLOCKS QUEUED
	CAILE	T1,777777		;HANDLE OVERFLOW
	MOVEI	T1,777777		;YES--MAKE MAXIMUM
	STOLIM	T1,.EQLIM(M),NBLK	;STORE BLOCKS*COPIES IN 2ND LIMIT WORD
CSND.1:	MOVE	M,FSTMSG		;GET FIRST MESSAGE ADDRESS
	MOVEI	T3,PAGSIZ(M)		;THE NEXT ONE
	MOVEM	T3,FSTMSG		;SAVE FOR NEXT GO AROUND
	DECR	NUMANS			;ONE LESS TO SEND
	MOVX	TF,MF.ACK		;GET FLAG FOR ACKNOWLEDGMENT
	MOVEM	TF,.MSFLG(M)		;AND SET IT
	MOVX	TF,%%.QSR		;VERSION NUMBER OF THE MESSAGE
	STORE	TF,.EQLEN(M),EQ.VRS	;STORE FOR QUASAR
	LOAD	T3,.EQROB+.ROBTY(M)	;GET THE QUEUE TYPE
	LOAD	T4,S.RDR		;GET THE /RDR SWITCH
	CAIN	T3,.OTBAT		;WAS IT THE BATCH QUEUE
	CAMN	T4,[-1]			;YES, AND  WAS /RDR SET ???
	JRST	SENDIT			;NO,,SEND THE MESSAGE
	MOVX	T3,.OTBIN		;YES,,GET THE SPRINT QUEUE ID
	STORE	T3,.EQROB+.ROBTY(M)	;RESET THE QUEUE TYPE
	LOAD	T3,.EQLEN(M),EQ.LOH	;GET THE HEADER LENGTH
	ADD	T3,M			;POINT TO THE FIRST FP
	MOVX	T4,.FPFSA		;GET 'STREAM ASCII' MODE
	STORE	T4,.FPINF(T3),FP.FFF	;SAVE THE THE FILE FORMAT

SENDIT:	TXO	M,1B0			;SIGN BIT IS PAGE MODE FLAG
	PUSHJ	P,MSGSND		;SEND OFF TO QUASAR
	PUSHJ	P,RCVACK		;GET THE "ACK" NOW
	JRST	CRESND			;SEND ANOTHER IF THERE IS ONE

SUBTTL NBLDEQ New Build EQ Block Routine (INP/OUT)

NBLDEQ:	SKIPN	T1,O.DIR		;ANY PPN SPECIFIED ???
	GETPPN	T1,			;NO,,GET OURS
	JFCL				;IGNORE THIS RETURN
	MOVEM	T1,.EQOID(M)		;AND MOVE IT INTO THE EQ
	PUSHJ	P,DOACCT		;FILL IN ACCOUNT STRING
	DATAM	O.NAM,,.EQJOB(M)
	DATAM	S.SEQ,,.EQSEQ(M),EQ.SEQ
	DATAM	O.MOD,FX.PRO,.EQSPC(M),EQ.PRO
	DATAM	S.NTF,,.EQSEQ(M),EQ.NOT
	SKIPLE	T1,S.AFT		;GET AFTER SWITCH
	ADDI	T1,3			;ADD 1 SECOND
	MOVEM	T1,.EQAFT(M)		;MOVE THE AFTER PARAMETER
	SKIPN	T1,S.PRI		;/PRIORITY:0 SPECIFIED?
	N$FATE	<PZR>,,</PRIORITY:0 not in range 1 to 63> ;SEE YA
	SKIPG	T1			;OK IF GREATER THAN ZERO
	SETZM	T1			;OH....WELL, TAKE THE DEFAULT
	STORE	T1,.EQSEQ(M),EQ.PRI	;SAVE IT IN MESSAGE
	DMOVE	T1,G$NAM1		;GET USER NAME
	DMOVEM	T1,.EQOWN(M)		;DEFAULT IT ...
	MOVSI	T1,S.USER		;POINT TO /USERNAME
	HRRI	T1,.EQUSR(M)		;MAKE A BLT POINTER
	MOVE	T2,S.USER		;GET FIRST WORD
	CAME	T2,[EXP -1]		;SPECIFIED?
	BLT	T1,.EQUSR+10-1(M)	;YES--COPY
	MOVSI	T1,S.DIST		;POINT TO /DISTRIBUTION
	HRRI	T1,.EQBOX(M)		;MAKE A BLT POINTER
	MOVE	T2,S.DIST		;GET FIRST WORD
	CAME	T2,[EXP -1]		;SPECIFIED?
	BLT	T1,.EQBOX+10-1(M)	;YES--COPY
	POPJ	P,			;AND RETURN

SUBTTL DOACCT Fill in the Accounting String

DOACCT:	PUSH	P,T1			;SAVE T1
	PUSH	P,T2			;SAVE T2
	PUSH	P,T3			;SAVE T3
	PUSH	P,T4			;SAVE T4
	PUSH	P,P1			;SAVE P1
	PUSH	P,P2			;SAVE P2
	PUSH	P,N			;SAVE N
	MOVX	T2,%CNST2		;WANT SECOND STATES WORD
	GETTAB	T2,			;GET IT
	 N$FATE<GUF>,,<GETTAB UUO Failed> ;NO,,END NOW
	TXNN	T2,ST%ACV		;IS ACCOUNT VALIDATION BEING DONE ???
	JRST	DOAC.2			;NO,,SKIP THIS
	MOVE	T1,S.ACCT		;DID USER SPECIFY AN ACCOUNT STRING ???
	CAME	T1,[-1]			;LOOK FOR -1 (ACCT NOT SPECIFIED)
	JRST	DOAC.1			;FOUND ONE,,GO PROCESS IT

;Here to default to user account string
;
DOAC.0:	MOVE	T1,[1,,T2]		;GET ACCT. PARMS
	MOVEI	T2,2			;GET PARM BLOCK LENGTH
	SETOM	T3			;WANT ACCOUNT STRING FOR THIS JOB
	HRROI	T4,.EQACT(M)		;GET POINTER TO WHERE WE WANT STRING PUT
	ACCT.	T1,			;READ THE ACCOUNT STRING INTO CREATE MSG
	SETZM	.EQACT(M)		;IT FAILED,,ZERO ACCOUNT STRING
	JRST	DOAC.2			;RETURN

;Here to fill in account string specified by the user
;
DOAC.1:	MOVSI	T3,S.ACCT		;GET SOURCE ACCT STRING ADDRESS IN LEFT
	HRRI	T3,.EQACT(M)		;GET DESTINATION BLT ADDRESS IN RIGHT
	BLT	T3,.EQACT+12-1(M)	;COPY IT OVER
	MOVX	T1,QF.RSP+.QUVAL	;WANT RESPONSE+ACCOUNT VALIDATION
	SETZM	T2			;NO NODE
	MOVE	T3,[1,,T1]		;WANT RESPONSE IN T1
	MOVE	T4,[10,,.QBACT]		;GET LENGTH,,TYPE
	MOVEI	P1,.EQACT(M)		;GET ACCOUNT STRING ADDRESS
	MOVX	P2,QA.IMM+.QBOID	;GET PPN BLOCK TYPE
	MOVE	N,.EQOID(M)		;GET THE OWNERS PPN
	MOVE	TF,[7,,T1]		;GET UUO BLOCK LEN,,ADDRESS
	QUEUE.				;REQUEST ACCOUNT VALIDATION
	  N$FATE<IAS>,,<Invalid account string specified>
DOAC.2:	POP	P,N			;RESTORE N
	POP	P,P2			;RESTORE P2
	POP	P,P1			;RESTORE P1
	POP	P,T4			;RESTORE T4
	POP	P,T3			;AND T3
	POP	P,T2			;AND T2
	POP	P,T1			;AND T1
	POPJ	P,			;AND RETURN
SUBTTL NLKFIL New Wild-Card LOOKUP Routine, Writes GALAXY Bits

;NLKFIL -- Routine to do wild card LOOKUP and build GALAXY CREATE BLOCK
;
;ENTER: With output block zeroed
;CALL:(	MOVEI	I,0	INITIALLY)
;	MOVEI	FP,ADDR. OF NEXT RESULT BLOCK
;	PUSHJ	P,NLKFIL
;	  ERROR RETURN IF NO MORE (MESSAGE ISSUED IF APPROPRIATE)
;	SKIP RETURN IF FILE FOUND, THE APPROPRIATE FILE POINTERS
;	WILL BE UPDATED IF NECESSARY TO POINT TO THE NEXT BLOCK
;	MFD, UFD FILES WILL BE POSITIONED FOR NEXT TIME IN.
;	THE .FDxxx BLOCK WILL BE BUILT AND APPENDED TO THE OUTPUT MESSAGE
;USES T1,T2,T3,T4,P1
;
NLKFIL:	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
	MOVE	P1,T1			;SAVE T1 UNTIL FP IS DONE
	  JRST	NLK.FP			;BUILD THE FP BLOCK FIRST

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;BUILD FP BLOCK
; .FPINF -- WORD # 1
;
NLK.FP:	MOVE	T4,I.MOD(I)		;GET FLAGS AND BITS
	MOVEI	T1,FILEASCII		;GET DEFAULT /FILE
	HLRZ	T2,RIBEXT		;GET EXTENSION
	CAIN	T2,'DAT'		;.DAT?
	MOVEI	T1,FILEFORTRAN		;YES, USE /FILE:FORT
	TXNN	T4,FP.FFF		;WAS IT ALREADY FILLED IN?
	STORE	T1,T4,FP.FFF		;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	T4,FP.DSP		;WAS /DISP: ALREADY SET?
	STORE	T1,T4,FP.DSP		;NO, FILL IT IN
	LOAD	T1,T4,FP.NFH		;GET THE FILE HEADER BIT
	SETCA	T1,			;FLIP
	STORE	T1,T4,FP.NFH		;SAVE /PRESERVE -OR- /DELETE
	LOAD	T1,T4,FP.DSP		;GET THE /DISP: VALUE
	CAIE	T1,.FPDEL		;WAS IT DELETE
	 TDZA	T1,T1			;NO, ZERO TEMP AND SKIP
	  MOVEI	T1,1			;YES, GET A BIT
	STORE	T1,T4,FP.DEL		;SET THE DELETE BIT CORRECTLY
	LOAD	T1,T4,FP.DSP		;GET THE /DISP: BITS
	TXZ	T4,FP.LOC		;CLEAR VARIOUS FLAGS
	MOVEI	T2,1			;GET A BIT FOR /DISP:RENAME
	CAIN	T1,.FPREN		;IS IT RENAME ???
	STORE	T2,T4,FP.REN		;YES, STORE THE BIT
	MOVEM	T4,.FPINF(FP)		;PUT .FPINF IN MESSAGE

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;FP BLOCK /TAG OR /BEGIN SWITCH
; .FPFST -- WORD # 2
;
NLFP.1:	MOVE	T1,I.STRT(I)		;GET /TAG OR /BEGIN SWITCH
	JUMPE	T1,NLFP.3		;DID WE FIND ONE ???
	JUMPE	J,NLFP.2		;YES, INPUT QUEUE ???
	TLNE	T1,770000		;NO, IS IT SIXBIT ???
	SETZM	T1			;YES ... IGNORE /TAG SWITCH
NLFP.2:	MOVEM	T1,.FPFST(FP)		;SAVE IN REQUEST

;FP BLOCK /REPORT SWITCH
; .FPFR1 -- WORDS # 3 AND 4
;
NLFP.3:	SETCM	T1,I.RPT(I)		;GET /REPORT SWITCH
	JUMPE	T1,NLFP.4		;DID WE FIND ONE ???
	DMOVE	T1,I.RPT(I)		;GET /REPORT
	DMOVEM	T1,.FPFR1(FP)		;AND SAVE IT

;FP BLOCK /FONT SWITCH
; .FPFNM -- WORDS # 7 THRU 16
;
NLFP.4:	MOVEI	FD,FPMSIZ		;SET FP SIZE WITHOUT FONT BLOCK
	SETCM	T1,I.FONT(I)		;GET /FONT SWITCH
	JUMPE	T1,NLFP.5		;DO WE HAVE ONE ???
	HRLI	T1,I.FONT(I)		;YES, GET ADDRESS /FONT NAME
	HRRI	T1,.FPFNM(FP)		;AND WHERE TO STORE IT
	BLT	T1,.FPFNM+FNMLTH-1(FP)	;STORE AWAY IN MESSAGE
	MOVEI	FD,FPXSIZ		;MAXIMUM FILE PARMS BLOCK
NLFP.5:	STORE	FD,.FPLEN(FP),FP.LEN	;STORE PARAMETERS SIZE IN CREATE

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;BUILD FD BLOCK
;
NLK.FD:	ADDI	FD,(FP)			;POINT TO WHERE FD BLOCK STARTS
	JUMPE	P1,[MOVE T1,I.MOD(I)
		    TXNN T1,FP.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,.FDSTR(FD)	;STORE IT
		    MOVEM T1,RIBDEV	;AND HERE ALSO
		    MOVE  T1,RIBNAM	;GET FILENAME
		    MOVEM T1,.FDNAM(FD)	;STORE IN REQUEST
		    MOVE  T1,RIBEXT	;GET EXTENSION
		    HLLZM T1,.FDEXT(FD)	;STORE IN REQUEST
		    JRST  NLK.PA]	;AND MAKE BELIEVE THE LOOKUP FAILED
	TXNN	P1,DV.DSK		;DOES IT THINK IT'S A DISK?
	JRST	E.NDD			;NO, NOT EVEN CLOSE
	TXNE	P1,DV.TTY		;YES, IF IT THINKS ITS A TTY, IT'S NUL:
	TRZE	F,R.ANUL		;YES, IT'S NUL:, DO WE ALLOW IT?
	JRST	NLK.LK			;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

NLK.LK:	MOVE	T1,OPNBLK+1		;GET ARGUMENT DEVICE
	MOVEM	T1,.FDSTR(FD)		;STORE AS STRUCTURE
	MOVE	T1,RIBNAM		;GET FILE NAME
	MOVEM	T1,.FDNAM(FD)		;STORE IN REQUEST
	MOVE	T1,RIBEXT		;GET FILE EXTENSION
	HLLZM	T1,.FDEXT(FD)		;STORE IN REQUEST
	OPEN	DC,OPNBLK		;OPEN CHANNEL
	  JRST	[PUSHJ P,E.DFO##
		 JRST  NLKFIL]

	MOVEI	T4,PTHFCN		;POINT TO USER PATH
	MOVX	T2,FP.NEW		;GET /NEW BIT
	TDNE	T2,I.MOD(I)		;TEST THE FILE (IS IT THE /NEW?)
	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	NLK.ER			;IF FAILURE
	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
	PUSHJ	P,.CHKTM##		;CHECK /BEFORE/SINCE
	  JRST	NLKFIL			;BAD--RECYCLE
	PUSHJ	P,ISBIN			;SEE IF BINARY AND IMPROPER
	  JRST	NLK.BN			;YES--GIVE ERROR
	SKIPE	T4,RIBDEV		;GET UNIT NUMBER
	MOVEM	T4,.FDSTR(FD)		;STORE INTO REQUEST
	MOVE	T4,RIBSIZ		;GET LENGTH IN WORDS
	ADDI	T4,177			;ROUND UP
	ASH	T4,-7			;CONVERT TO BLOCKS
	LOAD	T3,I.MOD(I),FP.FCY  	;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,FP.NEW		;GET THE /NEW BIT
	ANDCAM	T3,I.MOD(I)		;AND TURN IT OFF

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;VERIFY STRUCTURE NAME
;
NLK.ST:	MOVE	T1,.FDSTR(FD)		;GET FILE STRUCTURE
	DEVNAM	T1,			;GET THE REAL NAME
	  JRST	NLK.PA			;FAILED ASSUME NON-EXISTANT
	MOVEM	T1,STRBLK+.DCNAM	;CONVERT UNIT TO STRUCTURE
	MOVEI	T1,STRBLK		;SET ARGUMENTS FOR DSKCHR
	HRLI	T1,5			;5 WORD BLOCK
	DSKCHR	T1,			;DO THE CONVERSION AS I$MSTR DOES
	  JRST	NLK.PA			;FAILED, ASSUME NON-EXISTANT
	JUMPE	T1,NLK.PA		;IF WORKED BUT NO ANSWER, MUST BE NUL:
	MOVE	T2,STRBLK+.DCSNM	;GET STR NAME CONTAINING THIS UNIT
	TXNN	T1,DC.TYP		;IF RETURNED TYPE IS ZERO, THEN
	  JRST	[TRZN	F,R.ANUL	;ALLOW 'NUL:', IS IT LOG FD ?
		 N$FATE	<CSG>,,<Cannot Specify Generic Disk> ;NO, FAIL PRONTO
		 MOVE	T2,FDCSTR	;YES, GET FD CTL STR NAME
		 JRST .+1]		;CONTINUE ....
	MOVEM	T2,.FDSTR(FD)		;STORE IT BACK IN DATA BASE
	MOVEM	T2,FDCSTR		;SAVE THE FD'S STRUCTURE

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;FD PATH BLOCK
;
NLK.PA:	SETZM	.FDPPN(FD)		;CLEAR OUT DIRECTORY
	HRLI	T1,.FDPPN(FD)		; ..
	HRRI	T1,.FDPAT(FD)		; ..
	BLT	T1,.FDPPN+.FXLND-1(FD)	; ..
	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,.FDPPN(FD)		;SAVE IN QUEUE REQUEST
	MOVEI	T4,FDMSIZ		;AT LEAST A SHORT DESCRIPTOR
	STORE	T4,.FDLEN(FD),FD.LEN	;SAVE THAT SIZE
	TLNE	T1,-1			;SEE IF SFDS
	  JRST	NLK.EX			;NO--DONE WITH DIRECTORY
	MOVEI	T2,.FDPAT(FD)		;YES--POINT TO SFDS IN QUEUE REQUEST
	HRLI	T2,1-.FXLND		;COUNT NUMBER OF SFDS
NLK.P1:	SKIPN	T3,.PTPPN+1(T1)		;GET NEXT SFD
	  JRST	NLK.EX			;ALL DONE
	MOVEM	T3,(T2)			;STORE IN REQUEST
	INCR	T1			;ADVANCE FETCH
	LOAD	T4,.FDLEN(FD),FD.LEN	;PICK UP FD LENGTH
	INCR	T4			;ADD 1 TO IT
	STORE	T4,.FDLEN(FD),FD.LEN	;AND SAVE IT
	AOBJN	T2,NLK.P1		;LOOP OVER STORE

;END FD PATH BLOCK CODE
;

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;NLKFIL EXIT ROUTINE
;
NLK.EX:	LOAD	T1,.FDLEN(FD),FD.LEN	;GET LENGTH OF FD
	LOAD	T2,.FPLEN(FP),FP.LEN	;GET FP AREA LENGTH
	ADDI	T2,(T1)			;T2 = LENGTH OF AREA TO INCLUDE
	LOAD	T1,.MSTYP(M),MS.CNT	;GET CURRENT SIZE
	ADDI	T1,(T2)			;T1 = LENGTH INCLUDING THIS FILE
	STORE	T1,.MSTYP(M),MS.CNT	;STORE NEW LENGTH
	  JRST	.POPJ1			;IF SUCCESS RETURN

;HERE WHEN LOOKUP FAILS--SEE IF .NULL NEEDED OR /NEW SWITCH
;
NLK.ER:	MOVEM	T4,RIBPPN		;RESTORE DIRECTORY
	HRRZ	T2,RIBEXT		;GET LOOKUP ERROR CODE
	JUMPN	T2,NLK.BD		;GO ISSUE ERROR
	MOVE	T3,I.MOD(I)		;GET SWITCHES
	TXNN	T3,FP.NEW		;SEE IF /NEW
	JRST	NLK.BD			;NO--ERROR
	SETZM	RIBPRV			;CLEAR PROTECTION, ET
	TRNN	F,R.ANUL		;*.LOG FILE FD ???
	  JRST	NLK.PA			;NO, SO LET'S FAIL GRACEFULLY
	MOVX	T1,FX.NDV		;NULL DEVICE SPECIFIED?
	TDNN	T1,.FXMOD(I)		;...
	JRST	NLK.ST			;NO, WE CAN'T DO MORE
	ENTER	DC,LKBLK		;HMM, TRY AN ENTER TO GET STR
	  JRST	NLK.ST			;NO LUCK THERE
	MOVEI	T1,DC			;ARGUMENT IS CHANNEL NUMBER
	MOVEM	T1,STRBLK+.DCNAM	;SALT IT AWAY
	MOVE	T1,[.DCSNM+1,,STRBLK]	;POINT AT ARGUMENT
	DSKCHR	T1,			;SEE WHAT TYPE OF A DISK IT IS
	  SKIPA	T1,.FDSTR(FD)		;FAILED?  USE DEFAULT
	MOVE	T1,STRBLK+.DCSNM	;GET STRUCTURE NAME
	MOVEM	T1,.FDSTR(FD)		;SAVE IT AWAY
	MOVEI	T1,DC			;GET CHANNEL
	RESDV.	T1,			;ABORT THE ENTER
	  JFCL				;YOU KNOW HOW IT IS
	JRST	NLK.ST			;RETURN RESULTS

NLK.BD:	PUSHJ	P,E.DFL##		;ISSUE ERROR MESSAGE
	SKIPLE	S.ALLF			;DOES HE WANT ALL HIS FILES?
	N$FATE	<NAF>,,<Not All Requested Files Exist>	;YES, DIE NOW
	JRST	NLKFIL			;NO, LOOP BACK TO GET NEXT REQUEST

NLK.BN:	N$WARN	<CPB>,<N>,<Can't print binary>
	PUSHJ	P,.TFILE##
	JRST	NLKFIL			;LOOP FOR NEXT FILE

SUBTTL ISBIN  Check for Binary File Subroutine

;CALL:	PUSHJ	P,ISBIN
;ERROR RETURN IF WRONG
;SKIP RETURN IF OK
;USES T1, T2, T3, T4
;
ISBIN:	MOVX	T1,FP.OKB		;SEE IF /OKBINARY SWITCH
	TDNE	T1,I.MOD(I)		; ..
	JRST	.POPJ1			;YES--GIVE OK RETURN
	LOAD	T1,I.MOD(I),FP.FPF	;GET MODE
	LOAD	T2,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
	'EXEOVL'	;NEW SAVE FILE FORMAT,,OVERLAY
	'DBSSCH'	;DBMS FILE,,ANOTHER DBMS FILE
	'ATRUNV'	;SIMULA ATTRIBUTE FILE,,UNIVERSAL FILE
	'DMSFIN'	;1022 DATABASE,,"FINE" EDITOR BUFFER FILE

;ADD MORE HERE--FILL WITH A DUPLICATE--NEVER FILL WITH 0
LENBEX==.-BINEXT

SUBTTL	NMODFY New MODIFY routine

NMODFY:	SKIPL	S.BATL			;MODIFY /BATLOG SWITCH ???
	  N$FATE<CMB>,,<Can't modify /BATLOG switch>	;SEE YA
	SKIPL	S.NTF			;MODIFY /NOTIFY SWITCH ???
	  N$FATE<CMN>,,<Can't modify /NOTIFY switch>	;SEE YA

;SET UP THE TEMP AND MESSAGE AREAS
;
	PUSH	P,.JBFF##		;SAVE ORIGINAL .JBFF
	PUSHJ	P,MSETUP		;GET MEMORY ETC FOR MESSAGE
	TXO	M,1B0			;INDICATE PAGE MODE MESSAGE

;MODIFY MESSAGE HEADER
;
	MOVX	T1,<INSVL.(MOD.SZ,MS.CNT)!INSVL.(.QOMOD,MS.TYP)>
	MOVEM	T1,.MSTYP(M)		;STORE IN MESSAGE HEADER
	MOVX	T1,MF.ACK		;ASK QUASAR FOR AN
	MOVEM	T1,.MSFLG(M)		;ACKNOWLEDGEMENT

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;GROUP 0 -- Major Queue Items
;GROUP 0, HEADER
;
	MOVEI	P1,<MOD.FG+MOD.GN>(M)	;POINT TO THE FIRST GROUP HEADER
	MOVE	P2,P1			;COPY ADDRESS OF GROUP HEADER
	MOVX	T1,<.GPMAJ,,0>		;DO MAJOR REQUEST MODIFIES
	PUSHJ	P,GRPSTO		;STORE AND BUMP COUNTS

;GROUP 0, WORD 0
;
	MOVWRD	S.AFT			;/AFTER SWITCH

;GROUP 0, WORD 1
;
	MOVE	T1,S.PRI		;GET /PRIORITY SWITCH WORD
	CAMN	T1,[-1]			;DID WE TYPE IT IN ???
	  JRST	MOD.01			;NO, SAVE INDICATING NO CHANGE
	SKIPN	T1			;/PRIORITY:0 SPECIFIED?
	N$FATE	<PZR>,,</PRIORITY:0 not in range 1 to 63> ;SEE YA
	ANDI	T1,77			;MASK TO FIT
MOD.01:	PUSHJ	P,GRPSTO		;STORE /PRIORITY

;GROUP 0, WORD 2
;
	MOVWRD	[-1]			;/DEADLINE SWITCH, NO LONGER SUPPORTED

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;GROUP 0, WORD 3
;
	LOAD	T1,O.MOD,FX.PRO		;GET USER SPECIFIED PROTECTION
	CAIE	T1,777			;DID HE SAY /PROT:777?
	  JRST	MOD.02			;NO, DON'T CHANGE IT
	N$WARN	<PII>,,</PROTECT:777 is illegal, changed to 677>
	MOVEI	T1,677			;AND DO IT
MOD.02:	SKIPN	T1			;NOT SPECIFIED?
	SETOM	T1			;YES, SHOW NO CHANGE
	PUSHJ	P,GRPSTO		;STORE /PROTECTION

;GROUP 0, WORD 4
;
	JUMPN	J,MOD.03		;IF OUTPUT QUEUE, GO DO IT

;INPUT ATTRIBUTE WORD ROUTINE
;
	MOVE	T1,S.ATTRIB		;GET ATTRIBUTE SWITCH WORD
	CAMN	T1,[-1]			;DID WE TYPE IT IN ???
	  JRST	MOD.05			;NO, SAVE INDICATING NO CHANGE
	LOAD	T1,S.ATTRIB,RO.ATR	;GET ATTRIBUTES
	CAXE	T1,%SITGO		;IS IT SITGO ???
	MOVX	T1,%GENRC		;NO, MUST BE GENRIC
	HRLZS	T1			;MOVE BITS TO LEFT HALF
	  JRST	MOD.05			;SAVE INPUT ATTRIBUTE

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;OUTPUT MODIFY ATTRIBUTE ROUTINE
;
MOD.03:	SETZM	T1			;GET SOME ATTRIBUTES
	HLRZ	T2,O.DEV		;GET THE DEVICE
	CAIN	T2,'LL '		;IS IT LL?
	MOVX	T1,%LOWER		;YES,,LOAD LOWER CASE
	CAIN	T2,'LU '		;OR LU?
	MOVX	T1,%UPPER		;YES,,LOAD UPPER CASE
	HRLZS	T1			;MOVE BITS TO LEFT HALF
	
;OUTPUT MODIFY UNIT WORD CODE (MPB)
;MAY OVER WRITE T1, ENTRY IN MODIFY MESSAGE
;
	HRRZ	T2,O.DEV		;GET DEVICE ONCE MORE
	JUMPE	T2,MOD.04		;MPB FORMAT FIELD ???
	LDB	T3,[POINT 6,T2,23]	;YES, GET 4TH DIGIT
	CAIN	T3,'S'			;STATION SPECIFICATION?
	 JRST	MOD.04			;YES, NO MPB UNIT VALUE
	LDB	T4,[POINT 6,T2,35]	;GET THE 6TH CHAR
	TXNN	T2,7700			;IS THERE A NODE FIELD?
	LDB	T4,[POINT 6,T2,23]	;NO, GET 4TH DIGIT
	JUMPE	T4,MOD.04		;GO IF NO UNIT
	SUBI	T4,'0'			;ELSE, GET A UNIT
	TXO	T4,RO.PHY		;SET PHYSICAL UNIT BIT
	MOVE	T1,T4			;YES, SUPERCEDE PREVIOUS ATTRIBUTE

;OUTPUT MODIFY QUEUE /LOWER, /UPPER, AND /UNIT SWITCH CODE (GALAXY)
;MAY OVER WRITE T1, ENTRY IN MODIFY MESSAGE
;
MOD.04:	MOVE	T2,S.ATTRIB		;GET ATTRIBUTE SWITCH WORD
	CAME	T2,[-1]			;DID WE TYPE IT IN ???
	MOVE	T1,T2			;YES, SUPERCEDE PREVIOUS ATTRIBUTE

MOD.05:	SKIPN	T1			;DID WE FIND AN ATTRIBUTE ???
	  SETOM	T1			;NO, SO DON'T MODIFY IT
	PUSHJ	P,GRPSTO		;STORE /ATTRIBUTE VALUE

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;GROUP 0, WORD 5
;
	SKIPE	J			;THE INPUT QUEUE ???
	 SKIPA	T1,S.DEST		;NO--LOAD /DEST
	  MOVE	T1,S.PROC		;YES--LOAD /PROC
	CAMN	T1,[-1]			;DID WE TYPE IT IN ???
	  SKIPA				;NO, DON'T SET, CONVERT, OR DEFAULT
	PUSHJ	P,SETNODE		;CONVERT IT
	PUSHJ	P,GRPSTO		;STORE IT

;GROUP 0, WORD 6
;
	SETOM	T1			;CUSTOMER WORD, INDICATE NO CHANGE
	PUSHJ	P,GRPSTO		;STORE IT

;GROUP 1 -- Queue Dependent Items
;GROUP 1, HEADER
;
	MOVE	P2,P1			;COPY ADDRESS OF GROUP HEADER
	MOVX	T1,<.GPQUE,,0>		;DO QUEUE DEPENDENT MODIFY
	PUSHJ	P,GRPSTO		;STORE AND BUMP COUNTS
	MOVE	I,I.INZR		;GET THE FIRST REQUEST.
	JUMPN	J,MODOUT		;IF OUTPUT QUEUE, GO DO IT
	  JRST	MODINP			;MODIFY INPUT SPECIFIC FIELDS

	;CONTINUED ON THE NEXT PAGE
SUBTTL MODINP INPUT Specific Modification Routines

	;CONTINUED FROM PREVIOUS PAGE

;MODIFY INPUT QUEUE
;INP GROUP 1, WORD 0
;
MODINP:	MOVE	T1,S.COR		;GET /CORE LIMIT 
	JUMPL	T1,MOD.06		;SKIP THIS IF IT DIDN'T CHANGE
	ADDI	T1,PAGSIZ-1		;ROUND UP TO A PAGE BOUNDRY
	ADR2PG	T1			;CONVERT TO PAGES
MOD.06:	PUSHJ	P,GRPSTO		;STORE /CORE

;INP GROUP 1, WORD 1
;
	MOVWRD	S.LTIM			;DO/TIME LIMIT

;INP GROUP 1, WORD 2
;
	MOVWRD	S.LLPT			;DO /LPT LIMIT

;INP GROUP 1, WORD 3
;
	MOVWRD	S.LCDP			;DO /CDP LIMIT

;INP GROUP 1, WORD 4
;
	MOVWRD	S.LPTP			;DO /PTP LIMIT

;INP GROUP 1, WORD 5
;
	MOVWRD	S.LPLT			;DO /PLT LIMIT

;INP GROUP 1, WORD 6
;
	MOVE	T1,S.DPN		;GET THE /DEPENDENCY WORD
	JUMPL	T1,MOD.07		;SKIP THIS IF NO CHANGE
	LOAD	T1,S.DPN,MI.DEP		;GET VALUE
	LOAD	T2,S.DPN,MI.DMT		;GET TYPE (+,-,ABSOLUTE)
	HRLI	T1,(T2)			;INCLUDE TYPE CODE
MOD.07:	PUSHJ	P,GRPSTO		;STORE /DEPENDENCY COUNT

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;INP GROUP 1, WORD 7
;
	MOVE	T1,S.UNIQ		;GET /UNIQUE SWITCH
	JUMPL	T1,MOD.08		;SKIP THIS IF IT DIDN'T CHANGE
	CAIG	T1,2			;WAS IT :0 OR :NO ???
	MOVEI	T1,%EQUNO		;MAKE IT :NO
	CAILE	T1,2			;OR WAS IT :1 OR :YES ???
	MOVEI	T1,%EQUYE		;MAKE IT :YES
MOD.08:	PUSHJ	P,GRPSTO		;STORE /UNIQUE

;INP GROUP 1, WORD 8
;
	MOVE	T1,S.RSTR		;GET /RESTART SWITCH
	JUMPL	T1,MOD.09		;SKIP THIS IF IT DIDN'T CHANGE
	MOVX	T1,%EQRNO		;ASSUME /REST:NO
	SKIPE	S.RSTR			;IS IT /REST:NO ???
	MOVX	T1,%EQRYE		;NO, SO IT'S /REST:YES
MOD.09:	PUSHJ	P,GRPSTO		;STORE /RESTART

;INP GROUP 1, WORD 9
;
	MOVWRD	S.OUT			;DO /OUTPUT (/Z:)

;INP GROUP 1, WORD 10
;
	MOVE	T1,S.DEST		;YES, LOAD /DEST
	CAMN	T1,[-1]			;DID WE TYPE IT IN ???
	  SKIPA				;NO, DON'T SET, CONVERT, OR DEFAULT
	PUSHJ	P,SETNODE		;CONVERT IT
	PUSHJ	P,GRPSTO		;STORE /DEST (INP:)

;INP GROUP 1, WORD 11
;
	MOVWRD	S.ASST			;DO /ASSISTANCE (OINT)

;DO INP FILE SPECIFIC CHANGES NOW
;INP GROUP 1, WORD 12
;
	MOVWRD	I.STRT(I)		;DO /TAG OR /BEGIN

	  JRST	KILN.1			;FILL IN COMMON PART AND SEND MESSAGE

SUBTTL MODOUT OUTPUT Specific Modification Routines

;MODIFY OUTPUT QUEUE
;GROUP 1, WORD 0
;
MODOUT:	MOVWRD	S.FRM			;DO /FORMS

;GROUP 1, WORD 1
;
	MOVWRD	S.LIM			;DO /LIMIT

;GROUP 1, WORD 2
;
	MOVWRD	S.NOT			;DO /ANNOTATION (1ST HALF)

;GROUP 1, WORD 3
;
	MOVWRD	S.NOT+1			;DO /ANNOTATION (2ND HALF)

;OUTPUT FILE SPECIFIC MODIFY ROUTINE
;OUT GROUP 1, WORD 4
;
	NMDCHG	FP.NFH			;GET /HEADER
	SKIPL	T1			;SKIP IF NO CHANGE
	  TRC	T1,1			;FLIP IT FOR GALAXY
	PUSHJ	P,GRPSTO		;STORE /HEADER

;OUT GROUP 1, WORD 5
;
	NMDCHG	FP.FSP			;GET /SPACING
	PUSHJ	P,GRPSTO		;STORE /SPACING

;OUT GROUP 1, WORD 6
;
	NMDCHG	FP.FPF			;GET /PRINT FORMAT
	PUSHJ	P,GRPSTO		;STORE /PRINT

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;OUT GROUP 1, WORD 7
;
	NMDCHG	FP.FFF			;GET /FILE FORMAT
	PUSHJ	P,GRPSTO		;STORE /FILE

;OUT GROUP 1, WORD 10
;
	NMDCHG	FP.DSP			;GET /DISPOSITION
	CAIN	T1,DISPRENAME		;MODIFY /RENAME SWITCH ???
	  N$FATE<CMR>,,<Can't modify /DISPOSE:RENAME>	;SEE YA
	JUMPL	T1,MOD.10		;JUMP IF DIDN'T CHANGE
	CAIN	T1,.FPPRE		;WAS IT /DIS:PRESERVE
	 TDZA	T1,T1			;YES, CLEAR THE DELETE BIT
	  MOVEI	T1,1			;NO, SET THE DELETE BIT
MOD.10:	PUSHJ	P,GRPSTO		;STORE /DISP

;OUT GROUP 1, WORD 11
;
	NMDCHG	FP.FCY			;GET /COPY COUNT
	PUSHJ	P,GRPSTO		;STORE /COPIES

;OUT GROUP 1, WORD 12
;
	MOVWRD	I.RPT(I)		;/REPORT 1ST WORD

;OUT GROUP 1, WORD 13
;
	MOVWRD	I.RPT+1(I)		;/REPORT 2ND WORD

;OUT GROUP 1, WORD 14
;
	MOVWRD	I.STRT(I)		;STORE /BEGIN

	JRST	KILN.1			;FILL IN COMMON PART AND SEND MESSAGE

SUBTTL GRPSTO Subroutine to Add a MODIFY Element to the Message

;CALL:	PUSHJ	P,GRPSTO
;	T1 = THING TO STORE
;	P1 = CURRENT POINTER (WILL INCREMENT THIS AND MESSAGE LENGTH)
;	P2 = GROUP HEADER ADDRESS (WILL INCREMENT ELEMENT COUNT)
;
GRPSTO:	CAILE	P1,PAGSIZ-1(M)		;OFF THE END YET
	  N$FATE<TMF>,,<Too Many Files in File-Specific Modify>
	MOVEM	T1,(P1)			;STORE THIS ELEMENT
	LOAD	TF,.MSTYP(M),MS.CNT	;GET CURRENT COUNT
	INCR	TF			;ADD ANOTHER
	STORE	TF,.MSTYP(M),MS.CNT	;STORE IT
	INCR	MOD.GN(P2),MODGLN	;ANOTHER ELEMENT IN THIS GROUP
	INCR	P1			;ADVANCE FOR NEXT STORE
	POPJ	P,			;AND RETURN FOR THE NEXT

SUBTTL NKILL New KILL routine

;SET UP THE TEMP AND MESSAGE AREAS
;
NKILL:	PUSH	P,.JBFF##		;SAVE ORIGINAL .JBFF
	PUSHJ	P,MSETUP		;GET MEMORY ETC FOR MESSAGE

;KILL MESSAGE HEADER
;
	MOVX	T3,<INSVL.(KIL.SZ,MS.CNT)!INSVL.(.QOKIL,MS.TYP)>
	MOVEM	T3,.MSTYP(M)		;STORE IN MESSAGE HEADER
	MOVX	T3,MF.ACK		;SET FOR ACKNOWLEDGEMENT
	MOVEM	T3,.MSFLG(M)		;
KILN.1:	PUSHJ	P,GETOBJ		;GET OBJECT TYPE
	STORE	T3,KIL.OT(M)		;STORE IT
	MOVE	T1,O.NAM		;GET THE JOB NAME, COULD BE ZERO
	STORE	T1,KIL.RQ+.RDBJB(M)	;COPY THE JOB NAME
	MOVE	T1,O.NAMM		;GET THE MASK
	STORE	T1,KIL.RQ+.RDBJM(M)	;AND PUT IT IN THE MESSAGE
	SKIPG	T1,S.SEQ		;ANY SEQUENCE NUMBER ???
	SETZM	T1			;IF NEGATIVE, SET TO ZERO
	STORE	T1,KIL.RQ+.RDBES(M)	;STORE IT IN MESSAGE
	SKIPG	T1,S.RID		;GET THE REQUEST ID
	SETZM	T1			;IF NEGATIVE, SET TO ZERO
	STORE	T1,KIL.RQ+.RDBRQ(M)	;AND STORE IT IN THE MESSAGE
	MOVE	T1,O.DIR		;GET SPECIFIED PPN/DIRECTORY
	STORE	T1,KIL.RQ+.RDBOI(M)	;AND STORE IT
	MOVE	T1,O.DIRM		;GET THE PPN MASK
	STORE	T1,KIL.RQ+.RDBOM(M)	;AND ITS MASK
	PUSHJ	P,MSGSND		;SEND THE MESSAGE
	PUSHJ	P,RCVACK		;GET THE ACKNOWLEDGEMENT
	PJRST	CMDXIT			;AND RETURN TO CALLER

SUBTTL	NLIST  New LIST Routines

NLIST:	PUSHJ	P,LSTOPN		;OPEN THE LISTING FILE
	MOVE	I,I.INZR		;GET THE FIRST REQUEST.

;SET UP THE TEMP AND MESSAGE AREAS
;
	PUSH	P,.JBFF##		;SAVE ORIGINAL .JBFF
	PUSHJ	P,MSETUP		;GET MEMORY ETC FOR MESSAGE

;LIST MESSAGE HEADER
;
	MOVEI	T1,.OHDRS		;MAKE MESSAGE LENGTH FOR NOW
	STORE	T1,.MSTYP(M),MS.CNT	;AND SAVE IT.

	MOVX	T1,.QOLIS		;GET THE REQUEST TYPE.
	STORE	T1,.MSTYP(M),MS.TYP	;AND SAVE IT.

	SETZM	.OARGC(M)		;NO ARGS YET
	SETZM	.MSCOD(M)		;ZERO THE ACK CODE.

	MOVE	T1,S.LIST		;GET THE /LIST: BITS.
	SETZM	T2			;DEFAULT THE FLAG WORD
	CAIN	T1,LISTFAST		;DOES HE WANT A QUICK LISTING.
	MOVX	T2,LS.FST		;YES, GET THE /L:FAST BITS.
	CAIN	T1,LISTALL		;WAS IT /LIST:ALL ???
	MOVX	T2,LS.ALL		;YES, GET THE RIGHT BITS
	CAIN	T1,LISTSUMMARY		;/LIST:SUMMARY?
	MOVX	T2,LS.SUM		;YES
IFN FTDQS,<
	SKIPG	S.RMT			;DOES HE WANT A REMOTE LISTING TOO?
	SKIPE	S.QNM			;NOT EXPLICITLY, MAYBE BY DEFAULT?
	TXO	T2,LS.RMT		;YES
>; END IFN FTDQS
	MOVEM	T2,.OFLAG(M)		;SAVE IT IN THE MESSAGE.

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;QUEUE TYPE BLOCK # 0
;
	SETO	T3,			;ASSUME ALL QUEUES
	MOVEI	P2,.OHDRS(M)		;POINT TO FIRST FREE LIST BLOCK
	MOVE	T1,.FXDEV(I)		;GET THE DEVICE
	MOVE	T2,T1			;SAVE IT IN T2
	TRZ	T1,-1			;GET JUST GENERIC PART
	CAMN	T1,QUENMA		;IS IT 'ALLXXX' ???
	HRRZS	T2			;YES, MAKE IT 0,,XXX
	HLLZ	T2			;GET GENERIC DEVICE
	JUMPE	T2,NLST.3		;PROPER ASSUMPTION
	MOVSI	T3,-NDEVS		;MAKE AN AOBJN POINTER
NLST.1:	CAMN	T1,DEVTAB(T3)		;MATCH?
	JRST	NLST.2			;YES
	AOBJN	T3,NLST.1		;NO, LOOP
	SETZM	T3			;LET QUASAR THROUGH IT OUT
	JRST	NLST.3			;STORE RESULT
NLST.2:	MOVE	T3,LIQTAB(T3)		;GET MASK
NLST.3:	MOVEM	T3,LSTQUE		;SAVE FOR LATER
	MOVEI	T4,.LSQUE		;TYPE (QUEUES TO LIST)
	PUSHJ	P,NLSTBL		;ADD TO LIST BLOCK

;ID/PPN BLOCK # 1
;
	SKIPLE	S.CHK			;SEE IF /CHECK
	 JRST	[MOVE T1,.MYPPN		;YES--GET MY PPN
		 MOVEM T1,.FXDIR(I)	;SAVE AS SPECIFIED
		 SETOM .FXDIM(I)	;FLAG NO WILD CARDS
		 JRST  .+1]		;AND CONTINUE
	SKIPN	T3,.FXDIR(I)		;SEE IF USER ID/PPN GIVEN
	 JRST	NLST.4			;NO
	MOVEI	T4,.LSUSR		;TYPE (USER ID)
	PUSHJ	P,NLSTBL		;ADD TO LIST BLOCK

;ID/PPN MASK BLOCK # 2
;
	MOVE	T3,.FXDIM(I)		;GET USER ID MASK
	MOVEI	T4,.LSUSM		;TYPE (USER ID MASK)
	PUSHJ	P,NLSTBL		;ADD TO LIST BLOCK

;JOBNAME REQUESTED BLOCK # 3
;
NLST.4:	SKIPN	T3,.FXNAM(I)		;SEE IF JOB NAME GIVEN
	 JRST	NLST.5			;NO
	MOVEI	T4,.LSJOB		;TYPE (JOB NAME)
	PUSHJ	P,NLSTBL		;ADD TO LIST BLOCK

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;JOBNAME REQUESTED MASK BLOCK # 4
;
	MOVE	T3,.FXNMM(I)		;GET JOB NAME MASK
	MOVEI	T4,.LSJBM		;TYPE (JOB NAME MASK)
	PUSHJ	P,NLSTBL		;ADD TO LIST BLOCK

;ROB UNIT (MPB) BLOCK # 5
;
NLST.5:	SETOM	T3			;INDICATE NO MPB/GLX UNIT BITS YET
	HRRZ	T1,.FXDEV(I)		;GET DEVICE ONCE MORE
	JUMPE	T1,NLST.6		;MPB FORMAT FIELD ???
	LDB	T2,[POINT 6,T1,23]	;YES, GET 4TH DIGIT
	CAIN	T2,'S'			;STATION SPECIFICATION?
	 JRST	NLST.6			;YES, NO MPB UNIT VALUE
	LDB	T2,[POINT 6,T1,35]	;GET THE 6TH CHAR
	TXNN	T1,7700			;IS THERE A NODE FIELD?
	LDB	T2,[POINT 6,T1,23]	;NO, GET 4TH DIGIT
	JUMPE	T2,NLST.6		;GO IF NO UNIT
	SUBI	T2,'0'			;ELSE, GET A UNIT
	MOVE	T3,T2			;GET READY TO STORE MPB BITS
					;IF NECESSARY

;ROB /UNIT SWITCH (GALAXY) BLOCK # 5
;
NLST.6:	LOAD	T1,S.ATTRIB,RO.ATR	;YES, GET OBJECT ATTRIBUTES
	CAIN	T1,%PHYCL		;PHYSICAL UNIT ???
	MOVE	T3,S.ATTRIB		;YES, GET GALAXY UNIT BITS
	SKIPL	T3			;UNLESS NOT SPECIFIED,
	HRRZM	T3,LSTUNT		;SAVE FOR LATER
	MOVEI	T4,.LSUNT		;YES, SET TYPE (UNIT NUMBER)
	PUSHJ	P,NLSTBL		;AND ADD IT TO THE LIST BLOCK
	MOVE	T3,S.UNTY		;GET UNIT TYPE
	MOVE	T4,T3			;COPY IT
	AOJE	T4,NLST.7		;JUMP IF NONE REQUESTED
	MOVEM	T3,LSTUTY		;SAVE UNIT FOR LATER
	MOVEI	T4,.LSUTY		;BLOCK CODE FOR UNIT TYPE
	PUSHJ	P,NLSTBL		;ADD TO MESSAGE

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

;DESTINATION NODE (MPB) BLOCK # 6
;
NLST.7:	SETOM	T3			;INDICATE NO MPB/GLX DEST FIELD
	HRRZ	T1,.FXDEV(I)		;GET DEVICE ONCE MORE
	JUMPE	T1,NLS.7B		;MPB FORMAT FIELD ???
	TXNN	T1,7700			;YES, IS THERE A NODE FIELD?
	 JRST	NLS.7B			;NO, GOTO GALAXY FIELD PROCESSING
	SETZM	T3			;CLEAR AC FOR MPB NODE NUMBER
	LDB	T2,[POINT 6,T1,23]	;YES, GET 4TH CHAR
	CAIN	T2,'S'			;STATION SPECIFICATION?
	 JRST	NLS.7A			;YES, fooSnn COMMAND
	SUBI	T2,'0'			;NO, MAKE CHAR OCTAL
	DPB	T2,[POINT 3,T3,32]	;BUILD OCTAL NODE DEST NUMBER
	LDB	T2,[POINT 6,T1,29]	;GET 5TH CHAR
	SUBI	T2,'0'			;MAKE CHAR OCTAL
	DPB	T2,[POINT 3,T3,35]	;FINISH OCTAL NODE DEST NUMBER
	 JRST	NLS.7B			;CHECK FOR GALAXY BITS

NLS.7A:	LDB	T2,[POINT 6,T1,29]	;GET 5TH CHAR
	SUBI	T2,'0'			;MAKE CHAR OCTAL
	DPB	T2,[POINT 3,T3,32]	;BUILD OCTAL NODE DEST NUMBER
	LDB	T2,[POINT 6,T1,35]	;GET 6TH CHAR
	SUBI	T2,'0'			;MAKE CHAR OCTAL
	DPB	T2,[POINT 3,T3,35]	;FINISH OCTAL NODE DEST NUMBER

;DESTINATION NODE (GALAXY) BLOCK # 6
;
NLS.7B:	MOVE	T1,S.DEST		;GET /DESTINATION
	CAMN	T1,[-1]			;DO WE HAVE GALAXY BITS ???
	 JRST	NLS.7C			;NO, SO USE DEFAULT OR MPB BITS
	PUSHJ	P,SETNOD		;CONVERT IF NECESSARY
	MOVE	T3,T1			;YES, USE THEM INSTEAD OF MPB BITS
NLS.7C:	MOVEM	T3,LSTNOD		;SAVE FOR LATER
	MOVEI	T4,.LSDND		;BLOCK TYPE
	PUSHJ	P,NLSTBL		;ADD TO MESSAGE

;PROCESSING NODE BLOCK # 7
;
	MOVE	T1,S.PROC		;GET /PROCESSING
	PUSHJ	P,SETNOD		;CONVERT IF NECESSARY
	MOVE	T3,T1			;GET READY TO STORE IT
	MOVEI	T4,.LSPND		;BLOCK TYPE
	PUSHJ	P,NLSTBL		;ADD TO MESSAGE

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

IFN FTDQS,<
	SKIPE	S.QNM			;SEE IF /QUEUE
	PUSHJ	P,NLSTQN		;YES, ADD QUEUE NAME BLOCK TO MESSAGE
>; END IFN FTDQS

;SEND LIST MESSAGE TO QUASAR
;
	TXO	M,1B0			;INDICATE A PAGE FOR MSGSND
	PUSHJ	P,MSGSND		;SEND THE REQUEST

;RECEIVE MESSAGE FROM QUASAR
;

NLST.8:	MOVE	M,.JBFF##		;NOW FOR THE MESSAGES RETURNED,
	MOVEI	M,PAGSIZ-1(M)		;COMPUTE THE FIRST NON-EX PAGE.
	TRZ	M,PAGSIZ-1		;ZERO THE BOTTOM BITS.
	ADR2PG	M			;CONVERT IT TO A PAGE NUMBER.
	PUSHJ	P,QUEWAT		;WAIT FOR A MESSAGE FROM QUASAR
	MOVX	T3,IP.CFV		;IT'S A PAGED ANSWER
	SETZB	T4,P1			;CLEAR OTHER STUFF
	MOVEI	P2,(M)			;THE PAGE TO RECEIVE
	HRLI	P2,PAGSIZ		;COUNT FOR PAGE MODE
	MOVE	T2,[4,,T3]		;LENGTH,,ADDR
	IPCFR.	T2,			;REC, WAIT
	  SKIPA				;CAN'T
	JRST	NLST.9			;PROCESS THE MESSAGE
	CAXN	T2,IPCUP%		;OUT OF CORE ?
	N$FATE<NCL>,,<Not enough core to receive list answer>
	N$FATE<LRF>,,<List answer receive failed>

NLST.9:	PG2ADR	M			;CONVERT PAGE # TO AN ADDRESS.
	MOVEM	M,.JBFF##		;RESET THE LAST PAGE ADDRESS.
	INCR	.JBFF##			;BUMP IT BY 1 TO FORCE NEXT PAGE.
	MOVE	T2,ACKCOD		;GET THE CODE WE WANT TO SEE
	CAME	T2,.MSCOD(M)		;EXPECTING THIS MESSAGE?
	JRST	NLST.8			;NO, IGNORE IT
	PUSHJ	P,LSTTYO		;GO DUMP THE ANSWER.
	LOAD	T2,.OFLAG(M)		;GET THE FLAG BITS.
	TXNE	T2,WT.MOR		;WAS THIS THE LAST PAGE ???
	JRST	NLST.8			;NO,,GO GET ANOTHER PAGE.
	CLOSE	LC,			;YES, CLOSE THE CHANNEL
	RELEAS	LC,			;RELEASE THE CHANNEL
	PJRST	CMDXIT			;AND RETURN

SUBTTL NLSTBL Subroutine to Add Thing to LIST Message Block

;CALL:	PUSHJ	P,NLSTBL
;	T3/ DATA TO ADD
;	T4/ TYPE CODE
;ASSUMES (AND UPDATES) P2 TO BE POINTER TO NEXT FREE BLOCK

NLSTBL:	MOVEM	T3,ARG.DA(P2)		;STORE THE DATA
	STORE	T4,ARG.HD(P2),AR.TYP	;STORE THE TYPE
	MOVEI	T3,2			;THEY ARE TWO WORDS LONG
	STORE	T3,ARG.HD(P2),AR.LEN	;STORE THE LENGTH
	INCR	.OARGC(M)		;ONE MORE ARG
	ADDI	P2,2			;ADVANCE TO NEXT BLOCK
	LOAD	T3,.MSTYP(M),MS.CNT	;GET MESSAGE COUNT
	ADDI	T3,2			;UPDATE FOR WHAT WE STORED
	STORE	T3,.MSTYP(M),MS.CNT	;AND REMEMBER
	POPJ	P,			;RETURN

SUBTTL	NLSTQN Subroutine to store queue name string to LIST message block

;CALL:	PUSHJ	P,NLSTQN
;	S.QNM/ QUEUE NAME STRING
;ASSUMES (AND UPDATES) P2 TO BE POINTER TO NEXT FREE BLOCK

IFN FTDQS,<
NLSTQN:	MOVSI	T1,-QNMLEN		;SEE HOW LONG THE STRING IS
	SKIPE	S.QNM(T1)		;LOOK FOR A ZERO
	AOBJN	T1,.-1			;LOOP
	HRRZS	T1			;ISOLATE LENGTH OF QUEUE NAME STRING
	MOVEI	T2,ARG.DA(T1)		;LENGTH INCLUDING HEADER STUFF
	STORE	T2,ARG.HD(P2),AR.LEN	;STORE LENGTH
	MOVX	T2,.LSQNM		;GET THE BLOCK TYPE
	STORE	T2,ARG.HD(P2),AR.TYP	;STORE IN MESSAGE BLOCK
	MOVEI	T2,ARG.DA(P2)		;WHERE TO COPY THE STRING TO
	MOVE	T3,T2			;GET A COPY
	HRLI	T2,S.QNM		;SOURCE ADDRESS
	ADDI	T3,-1(T1)		;ADD LENGTH -1
	BLT	T2,(T3)			;COPY THE STRING
	INCR	.OARGC(M)		;COUNT ANOTHER BLOCK
	LOAD	T2,.MSTYP(M),MS.CNT	;GET MESSAGE COUNT
	ADDI	T2,ARG.DA(T1)		;INCLUDE THIS BLOCK
	STORE	T2,.MSTYP(M),MS.CNT	;UPDATE FOR WHAT WE STORED
	ADDI	P2,ARG.DA(T1)		;ADVANCE TO NEXT BLOCK
	POPJ	P,			;RETURN
>; END IFN FTDQS
SUBTTL LSTOPN Listing routines - Open the listing file

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

LSTO.1:	OPEN	LC,L.OPEN		;INIT THE DEVICE
	  N$FATE <LOF>,<N>,<Listing OPEN failure on device>
	ENTER	LC,L.LOOK		;ENTER FILE
	  JRST	E.OEFE			;ERROR
	OUTBUF	LC,0			;BUILD BUFFERS BEFORE WE MANGLE CORE
	MOVEI	T1,L.PATH		;POINT TO LISTING PATH BLOCK
	MOVEM	T1,L.LOOK+.RBPPN	;STORE FOR FILESPEC TYPEOUT
	MOVEI	T1,LC			;GET THE CHANNEL NUMBER
	DEVCHR	T1,			;GET DEVICE CHARACTERISTICS
	TXNE	T1,DV.TTY		;SEE IF LINE MODE OUTPUT DEVICE
	TRO	F,R.OUTL		;YES--SET FLAG TO FORCE OUT EACH LINE
	TLC	T1,-1-<(DV.TTA)>	;SEE IF NUL:
	TLCN	T1,-1-<(DV.TTA)>	; ..
	JRST	LSTDEV			;IT IS - HANDLE NON-DIRECTORY DEVICE
	TXNE	T1,DV.TTA		;CONTROLLING TTY ?
	POPJ	P,			;YES - THEN DON'T OUTPUT A MESSAGE
	TXNE	T1,DV.MTA		;A MAGTAPE ?
	JRST	LSTMTA			;YES
	TXNE	T1,DV.DSK		;A DISK ?
	JRST	LSTDSK			;YES
	TXNE	T1,DV.DIR		;DIRECTORY DEVICE ?
	JRST	LSTDIR			;YES - HANDLE DIFFERENTLY
	JRST	LSTDEV			;MUST BE A RANDOM DEVICE
SUBTTL LSTMTA Listing routines - Type out listing filespec

LSTMTA:	MOVE	T1,[3,,T2]		;SET UP AC
	MOVX	T2,.TFDEN+.TFSET	;FUNCTION CODE
	MOVEI	T3,LC			;LOAD CHANNEL NUMBER
	LOAD	T4,O.MOD,FX.DEN		;GET DENSITY
	TAPOP.	T1,			;SET IT
	  JFCL				;IGNORE ERRORS
	MOVE	T1,[3,,T2]		;SET UP AC
	MOVX	T2,.TFPAR+.TFSET ;LOAD FUNCTION CODE
	MOVEI	T3,LC			;LOAD CHANNEL NUMBER
	LOAD	T4,O.MOD,FX.PAR		;GET PARITY BIT
	TAPOP.	T1,			;SET ODD OR EVEN PARITY
	  JFCL				;IGNORE ERRORS
	N$INFO	<QLF>,<N>,<Queue listing on file>
	MOVEI	T1,LC			;GET CHANNEL NUMBER
	DEVNAM	T1,			;WANT THE REAL NAME
	  MOVE	T1,L.OPEN+.OPDEV	;ASSUME NAME FROM OPEN BLOCK
	PUSHJ	P,.TSIXN##		;TYPE IT
	PUSHJ	P,.TCOLN##		;TYPE COLON
	MOVEI	T1,[ASCIZ |, density = |]
	PUSHJ	P,.TSTRG##		;TYPE TEXT
	MOVE	T1,[3,,T2]		;SET UP AC
	MOVX	T2,.TFDEN		;FUNCTION CODE
	MOVEI	T3,LC			;LOAD CHANNEL NUMBER
	TAPOP.	T1,			;READ DENSITY
	  MOVEI	T1,0			;CAN'T - ASSUME DEFAULT
	CAILE	T1,DENMAX		;GREATER THAN HIGHEST KNOWN DENSITY ?
	  MOVX	T1,-1			;UNKNOWN
	MOVE	T1,DENTAB(T1)		;PICK UP DENSITY TEXT
	PUSHJ	P,.TSTRG##		;TYPE IT
	JRST	LSTEND			;GO TO COMMON ENDING

; DENSITY TABLE
;
	[ASCIZ	|Unknown|]
DENTAB:	[ASCIZ	|Default|]
	[ASCIZ	|200|]
	[ASCIZ	|556|]
	[ASCIZ	|800|]
	[ASCIZ	|1600|]
	[ASCIZ	|6250|]
DENMAX==.-DENTAB
LSTDEV:	N$INFO	<QLF>,<N>,<Queue listing on file>
	MOVEI	T1,LC			;GET CHANNEL NUMBER
	DEVNAM	T1,			;WANT THE REAL NAME
	  MOVE	T1,L.OPEN+.OPDEV	;ASSUME NAME FROM OPEN BLOCK
	PUSHJ	P,.TSIXN##		;TYPE IT
	PUSHJ	P,.TCOLN##		;TYPE COLON
	JRST	LSTEND			;GO TO COMMON ENDING

LSTDSK:	MOVEI	T1,LC			;GET CHANNEL NUMBER
	MOVEM	T1,L.PATH		;STORE IT
	MOVEM	T1,L.DSKC		;STORE IN DSKCHR BLOCK TOO
	MOVE	T1,[.PTMAX,,L.PATH]	;SET UP CALL
	PATH.	T1,			;READ PATH OF CHANNEL
	  JFCL				;IGNORE ERRORS
	MOVE	T1,[LN$DSK,,L.DSKC]	;SET UP DSKCHR UUO
	DSKCHR	T1,			;SEE WHAT THE DEVICE REALLY IS
	  SKIPA	T1,L.OPEN+.OPDEV 	;CAN'T
	SKIPE	T1,L.DSKC+.DCSNM 	;GET STRUCTURE NAME (GUARD AGAINST NUL:)
	MOVEM	T1,L.OPEN+.OPDEV	;STORE IT
					;FALL INTO LSTDIR

LSTDIR:	N$INFO	<QLF>,<N>,<Queue listing on file>
	MOVEI	T1,L.OPEN		;POINT TO THE OPEN BLOCK
	MOVEI	T2,L.LOOK		;POINT TO THE ENTER BLOCK
	PUSHJ	P,.TOLEB##		;TYPE FILESPEC

LSTEND:	PUSHJ	P,FINFO2		;CLOSE OFF THE MESSAGE
	PUSHJ	P,LSTHDR		;TYPE LISTING HEADER
	POPJ	P,			;RETURN
SUBTTL LSTHDR Listing routines - Header generation

LSTHDR:	MOVEI	T1,LSTCHR		;GET OUT ROUTINE TO PUT A CHARACTER
	PUSHJ	P,.TYOCH##		;TELL SCAN ABOUT IT
	MOVEM	T1,L.OTYO		;REMEMBER THE OLD SETTING
	PUSHJ	P,.TCRLF##		;NEW LINE
	MOVEI	T1,[ASCIZ |Listing by QUEUE version |]
	PUSHJ	P,.TSTRG##		;TYPE HEADER INTRO
	MOVE	T1,.JBVER		;GET OUT VERSION NUMBER
	PUSHJ	P,.TVERW##		;TYPE IT
	MOVEI	T1,[ASCIZ | on |]	;SEPERATOR
	PUSHJ	P,.TSTRG##		;TYPE INTRO
	PUSHJ	P,.TDATN##		;TYPE THE CURRENT DATE
	MOVEI	T1,[ASCIZ | at |]	;GET SEPERATOR
	PUSHJ	P,.TSTRG##		;TYPE TEXT
	PUSHJ	P,.TTIMN##		;TYPE THE CURRENT TIME
	PUSHJ	P,.TCRLF##		;NEW LINE
	PUSHJ	P,.TCRLF##		;AND ANOTHER
	MOVE	T1,L.OTYO		;GET OLD TYPE OUT ROUTINE
	PUSHJ	P,.TYOCH##		;TELL SCAN
	POPJ	P,			;RETURN
SUBTTL LSTTYO Listing routines - Output the list answer

LSTTYO:	MOVEI	T1,.OHDRS(M)		;POINT TO THE FIRST MESSAGE BLOCK.
	LOAD	T2,ARG.HD(T1),AR.LEN	;GET THE BLOCK LENGTH.
	SOSLE	.OARGC(M)		;CHECK THE ARGUMENT COUNT.
	ADD	T1,T2			;IF 2 BLOCKS,,GET 2ND BLOCK ADDRESS.
	MOVEI	T1,ARG.DA(T1)		;GET ADDRESS OF STRING
	HRLI	T1,(POINT 7,)		;MAKE A BYTE POINTER
	MOVEM	T1,L.PNTR		;STORE BYTE POINTER

LSTT.1:	ILDB	T1,L.PNTR		;GET A CHARACTER
	PUSHJ	P,LSTCHR		;PUT A CHARACTER
	JUMPE	T1,.POPJ##		;DONE IF WE ENCOUNTER A <NUL>
	CAILE	T1,.CHFFD		;END OF LINE ?
	JRST	LSTT.1			;NO - CONTINUE
	TRNE	F,R.OUTL		;OUTPUT ON EVERY LINE ?
	PUSHJ	P,LSTC.1		;YES - DO IT NOW
	JRST	LSTT.1			;LOOP BACK FOR MORE CHARACTERS
	POPJ	P,			;RETURN.

LSTCHR:	SOSG	B.LC+.BFCNT		;ROOM IN THE BUFFER ?
	PUSHJ	P,LSTC.1		;BUFFER FULL - WRITE IT OUT
	IDPB	T1,B.LC+.BFPTR		;PUT A CHARACTER
	POPJ	P,			;RETURN

LSTC.1:	OUT	LC,			;OUTPUT BUFFER
	  POPJ	P,			;NO ERRORS - RETURN
	PUSHJ	P,.PSH4T##		;SAVE T3 - P2 (T1,T2,T3,T4)
	GETSTS	LC,L.STAT		;GET CHANNEL STATUS
	MOVE	T3,L.STAT		;PREPARE TO CLEAR
	TXZ	T3,IO.ERR		; BY PRESERVING JUST
	SETSTS	LC,(T3)			;  THE CONTROL BITS
	N$WARN	<LDE>,<N>,<Listing device output error, status =>
	HRLZ	T2,L.STAT		;GET STATUS IN LH OF T2
	MOVEI	T3,6			;SET UP COUNTER

LSTC.2:	LSHC	T1,3			;SHIFT IN A DIGIT
	ANDI	T1,7			;NO JUNK
	ADDI	T1,"0"			;MAKE IT ASCII
	PUSHJ	P,.TCHAR##		;TYPE IT
	SOJG	T3,LSTC.2		;LOOP FOR ANOTHER
	PUSHJ	P,.TCRLF##		;NEW LINE
	PUSHJ	P,.POP4T##		;RESTORE T3 - P2 (T1,T2,T3,T4)
	POPJ	P,			;BACK FOR MORE CHARACTERS
SUBTTL	NDEFER New DEFER & ZDEFER Routine

NDEFER:	MOVE	T1,I.INZR		;GET POINTER TO FIRST INPUT SPEC
	SKIPE	.FXNMM(T1)		;CHECK MASK FOR * OR ?????? TYPED
	  N$FATE<CDF>,,<Cannot /DEFER specific files>
	ADDI	T1,I.LZER		;POINT TO NEXT
	CAMGE	T1,I.NXZR		;WAS ONLY ONE SPEC SPEFICIED
	  N$FATE<TDR>,,<Too may deferred requests>

;SET UP THE TEMP AND MESSAGE AREAS
;
	PUSH	P,.JBFF##		;SAVE ORIGINAL .JBFF
	PUSHJ	P,MSETUP		;GET MEMORY ETC FOR MESSAGE

;DEFER MESSAGE HEADER
;
	MOVX	T1,<INSVL.(DFR.SZ,MS.CNT)!INSVL.(.QODFR,MS.TYP)>
	MOVEM	T1,.MSTYP(M)		;STORE MESSAGE AND LENGTH

	MOVX	T1,MF.ACK		;SET FOR ACKNOWLEDGEMENT
	MOVEM	T1,.MSFLG(M)		;

	MOVE	T2,S.OPN		;GET THE OPERATION SPECIFIED
	SETOM	S.OPN			;RESET THE OPERATION FIELD
	SETOM	T1,			;CLEAR T1
	CAIN	T2,.QORCR		;/CREATE?
	MOVEI	T1,.DFREL		;YES, PASS DEFER FUNCTION
	CAIN	T2,.QORKL		;/KILL?
	MOVEI	T1,.DFKIL		;PASS /ZDEFER
	SKIPGE	T1			;MUST BE ONE OR THE OTHER
	  N$FATE<DMI>,,</DEFER request must include /CREATE or /KILL> ;NO
	STORE	T1,DFR.JB(M),DF.FNC	;YES, STORE THE DEFER FUNCTION

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

	PJOB	T1,			;FOR THIS JOB NUMBER
	STORE	T1,DFR.JB(M),DF.JOB	;STORE THE JOB NUMBER

	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,O.DEV		;SAVE DEVICE IN O.DEV
	SKIPE	T3,O.DEV		;SKIP IF HE WANTS ALL QUEUES
	PUSHJ	P,GETOBJ		;GET THE OBJECT
	MOVEM	T3,DFR.OT(M)		;STORE THE OBJECT
	PUSHJ	P,MSGSND		;SEND OFF THE MESSAGE
	PUSHJ	P,RCVACK		;GET ACKNOWLEDGEMENT
	PJRST	CMDXIT			;USE THE NORMAL EXIT

SUBTTL	CMDXIT Return Routine
 
CMDXIT:	POP	P,.JBFF##		;RESTORE ORIGINAL .JBFF
	MOVE	T3,.JBFF##		;GET THE VALUE
	SUBI	T3,1			;BACK OFF FOR THE CORE UUO
	CORE	T3,			;GIVE SOME BACK
	  JFCL				;NICE TRY
	POPJ	P,			;RETURN FOR NEXT COMMAND

RESCOR:	MOVE	T3,-1(P)		;.JBFF IS DOWN ON THE STACK
	MOVEM	T3,.JBFF##		;RESET IT
	SUBI	T3,1			;BACK OFF FOR THE CORE UUO
	CORE	T3,			;GIVE SOME BACK
	  JFCL				;NICE TRY
	POPJ	P,			;RETURN TO CALLER
SUBTTL MSETUP Subroutine to Setup Temp and Message Areas

MSETUP:	PUSHJ	P,QUEFLS		;FLUSH THE RECEIVE QUEUE FIRST
	PUSHJ	P,GQPID			;GET QUASAR'S PID
	PUSHJ	P,BLDACK		;GO BUILD AN ACK CODE

	SETZM	FSTMSG			;CLEAR ADDRESS OF FIRST MESSAGE
	SETZM	NUMANS			;AND NUMBER OF CREATES TO SEND

;GET AND CLEAR PAGE FOR MESSAGE
;
MSUP.1:	MOVE	M,.JBFF##		;CREATE MESSAGES ARE PAGE MODE SO
	MOVEI	M,PAGSIZ-1(M)		;ALIGN .JBFF ON A PAGE BOUNDRY
	TRZ	M,PAGSIZ-1		;MAKE IT SO
	MOVEM	M,.JBFF##		;FAKE OUT CORGET
	SOS	.JBFF			;BACK OFF BY ONE
	GCORE	PAGSIZ			;GET A PAGE FOR IT

	SETZM	(M)			;CLEAR THE NEW MESSAGE FIRST
	HRLI	T1,(M)			;SET UP FOR EVENTUAL BLT
	HRRI	T1,1(M)			;DESTINATION
	BLT	T1,PAGSIZ-1(M)		;GET IT ALL

	SKIPN	FSTMSG			;THIS THE FIRST ONE
	  MOVEM	M,FSTMSG		;YES, SAVE ITS ADDRESS
	INCR	NUMANS			;ACCOUNT FOR IT
	  POPJ	P,			;AND RETURN

SUBTTL QUEFLS Subroutines to Flush the IPCF Receive Queue

QUEFLS:	PUSHJ	P,QUEQRY		;QUERY THE QUEUE
	JUMPE	T2,CPOPJ		;RETURN WHEN EMPTY
	PUSHJ	P,QUEIGN		;IGNORE THE ENTRY
	JRST	QUEFLS			;AND KEEP GOING

QUEQRY:	SETZB	T3,T4			;CLEAR QUERY BLOCK
	SETZB	P1,P2			;FOR GOOD MEASURE
	MOVE	T2,[4,,T3]		;LENGTH,,ARGUMENTS
	IPCFQ.	T2,			;FIND OUT WHATS THERE
	  SETZM	P2			;NOTHING, CLEAR P2
	MOVE	T2,P2			;COPY QUEUE STATUS INTO T2
	JUMPE	T2,CPOPJ		;RETURN IF NOTHING THERE
	SKIPE	DEBUGW			;IF DEBUGGING,
	CAME	T4,INFPID		;COULD BE FROM INFO
	CAMN	T4,QSRPID		;FROM QUASAR
	  POPJ	P,			;YES, RETURN NOW
	PUSHJ	P,QUEIGN		;FLUSH THE JUNK MAIL
	JRST	QUEQRY			;LOOK AGAIN

QUEIGN:	ANDX	T3,IP.CFV		;CLEAR ALL BUT PAGE MODE BIT
	TXO	T3,IP.CFT		;SET TO TRUNCATE
	SETZB	T4,P1			;CLEAR THEM AGAIN
	MOVEI	P2,1			;LENGTH = 0 , LOC = 1
	MOVE	T2,[4,,T3]		;SET UP LENGTH AND BLOCK ADDRESS
	IPCFR.	T2,			;THROW AWAY THE MESSAGE
	  N$FATE<CFR>,,<Cannot flush the IPCF receive queue>
	POPJ	P,			;RETURN

QUEWAT:	PUSHJ	P,QUEQRY		;FIND OUT WHATS THERE
	JUMPN	T2,CPOPJ		;SOMETHING, RETURN
	MOVX	T2,HB.IPC		;WAKE ON IPCF PACKET AVAILABLE
	HIBER	T2,			;WAIT FOR A REASONABLE TIME
	  JFCL				;WATCH THIS LOOP
	JRST	QUEWAT			;TRY NOW

SUBTTL GQPID  Get the PID for QUASAR

GQPID:	SKIPN	DEBUGW			;ARE WE DEBUGGING?
	JRST	GQPI.1			;NO, USE SYSTEM-QUASAR
	PUSHJ	P,MAKNAM		;MAKE UP NAME TO LOOK FOR
	MOVE	P2,T1			;LENGTH AND POSITION OF PACKET
	MOVX	T1,SP.INF		;GET PID FOR SYSTEM-INFO
	PUSHJ	P,FPID			;
	JUMPE	T1,GQPI.1		;IF NO INFO, GIVE UP
	MOVE	P1,T1			;REMEMBER THE PID
	MOVEM	P1,INFPID		;
	SETZB	T3,T4			;NO FLAGS, CLEAR PID
	PUSHJ	P,MSGGO			;SEND THE MESSAGE TO INFO
	PUSHJ	P,RCVACK		;WAIT FOR REPLY
	LOAD	T1,T3,IP.CFE		;CHECK FOR ERRORS
	JUMPN	T1,GQPI.1		;
	OUTSTR	[ASCIZ /% Connecting to /]
	OUTSTR	SHTMSG+.IPCI2
	PUSHJ	P,TTCRLF		;ADD CRLF
	MOVE	T1,SHTMSG+.IPCI1	;GET PRIVATE QUASAR'S PID

GQPI.4:	MOVEM	T1,QSRPID		;STORE THE PID
	POPJ	P,			;THEN RETURN

GQPI.1:	SETOM	T3			;FLAG FOR FIRST TIME
GQPI.2:	MOVX	T1,SP.QSR		;PID OF QUASAR
	PUSHJ	P,FPID			;LOOK IT UP
	JUMPN	T1,GQPI.4		;IF WE GOT THE PID , RETURN NOW
	AOJN	T3,GQPI.3		;FIRST TIME IT FAILED?
	N$WARN	<WFQ>,,<Waiting for [SYSTEM]QUASAR to start>
GQPI.3:	MOVEI	T1,3			;WAIT FOR 3 SECONDS
	SLEEP	T1,			;SLEEP FOR SPECIFIED TIME
	JRST	GQPI.2			;AND TRY AGAIN

;GET PID FOR SYSTEM-INFO
;
FPID:	HRLI	T1,.GTSID		;WANT FROM SYSTEM PID TABLE
	MOVSS	T1
	GETTAB	T1,			;ASK FOR IT
	  SETZM	T1			;IF IT FAILS,
	POPJ	P,			;AND RETURN

SUBTTL BLDACK Build ACK Code Subroutine

;ACK CODE STORED IN ACKCOD
;
BLDACK:	SETZM	ACKCOD			;CLEAR TARGET
	PJOB	T1,			;GET OUR JOB NUMBER
	STORE	T1,ACKCOD,ACK.JB	;PUT IN PROPER PLACE
	MOVX	T1,%CNDTM		;GET UDT
	GETTAB	T1,			;ASK THE MONITOR
	  SETZM	T1			;OH WELL
	STORE	T1,ACKCOD,ACK.UT	;STORE IN UDT FIELD OF CODE
	POPJ	P,			;RETURN

SUBTTL GETOBJ Subroutine to Convert Device to an Object Type

;DEVICE NAME IN O.DEV, RETURN WITH T3 CONTAINING OBJECT
;
GETOBJ:	HLLZ	T3,O.DEV		;GET GENERIC DEVICE
	MOVSI	T4,-NDEVS		;MAKE AN AOBJN POINTER

GETO.1:	CAMN	T3,DEVTAB(T4)		;DO A COMPARE
	JRST	GETO.2			;WIN
	AOBJN	T4,GETO.1		;LOOP
	JRST	E.NOQS			;LOSE

GETO.2:	MOVE	T3,OBJTAB(T4)		;GET THE OBJECT
	POPJ	P,			;AND RETURN

SUBTTL MSGSND Subroutine to Send a Message to QUASAR

MSGSND:	MOVE	P1,QSRPID		;GET QUASAR'S PID
	SETOM	RTYCNT			;INIT RETRY COUNTER
	MOVE	T3,ACKCOD		;GET ACK CODE
	MOVEM	T3,.MSCOD(M)		;PUT IN MESSAGE HEADER
	SETZB	T3,T4			;CLEAR FLAGS,MY PID
	MOVEI	P2,(M)			;MESSAGE ADDRESS, P1 = QSRPID
	LOAD	T2,.MSTYP(M),MS.CNT	;GET THE LENGTH OF THE MESSAGE
	TXNN	M,1B0			;IS THIS A PAGE MODE REQUEST
	  JRST	MSGGO1			;NO, SEND IT
	MOVX	T3,IP.CFV		;INDICATE A PAGE SEND
	LSH	P2,-^D9			;CONVERT 'M' TO A PAGE NUMBER
	MOVEI	T2,PAGSIZ		;LENGTH MUST BE 1000
MSGGO1:	HRL	P2,T2			;INCLUDE CORRECT SIZE IN HEADER
MSGGO:	MOVE	T2,[4,,T3]		;ARGUMENT FOR SEND
	IPCFS.	T2,			;SEND THE MESSAGE
	 SKIPA				;FAILED, SEE WHY
	  POPJ	P,			;RETURN TO CALLER
	CAIE	T2,IPCDD%		;QUASAR DISABLED
	 CAIN	T2,IPCRS%		;OR MY QUOTA EXHAUSTED
	  JRST	RETRY			;YES, TRY IT AGAIN
	CAIE	T2,IPCRR%		;QUASAR FULL
	 CAIN	T2,IPCRY%		;OR SYSTEM FULL
	  JRST	RETRY			;YES, TRY IT AGAIN
	N$FATE <SQF>,,<Send to [SYSTEM]QUASAR failed>
RETRY:	MOVEI	T2,2			;WAIT BEFORE TRYING AGAIN
	SLEEP	T2,			;TAKE A QUICK NAP
	AOSN	RTYCNT			;COUNT THE RETRIES
	N$WARN	<MBR>,,<Send has failed, message being re-sent>
	JRST	MSGGO			;NOW RETRY IT

SUBTTL RCVACK Subroutine to Receive an Expected "ACK" from QUASAR

;	RVCACK RETURNS CALLER AFTER RECEIVING A"GOOD" ONE,
;	ISSUES AN ERROR MESSAGE AND QUITS ON A "BADDY"
;
RCVACK:	MOVEI	M,SHTMSG		;AREA FOR SHORT RECEIVE
	PUSHJ	P,QUEWAT		;WAIT FOR A RETURNED MESSAGE
	ANDX	T3,IP.CFV		;CLEAR ALL BUT THE PAGE MODE BIT
	SETZB	T4,P1			;CLEAR THESE AGAIN
	HRRI	P2,(M)			;WHERE TO RECEIVE INTO
	TXNN	T3,IP.CFV		;IS IT A PAGE
	  JRST	RCVA.1			;NO, GO GET IT
	MOVE	M,.JBREL##		;GET A PAGE TO RECEIVE INTO
	MOVEI	M,PAGSIZ-1(M)		;ROUND UP
	ADR2PG	M			;CONVERT TO PAGE NUMBER
	HRRI	P2,(M)			;SET THE ADDRESS
	HRLI	P2,PAGSIZ		;LENGTH OF A PAGE
	PG2ADR	M			;STILL NEED TO POINT TO IT
RCVA.1:	MOVE	T2,[4,,T3]		;READY TO GET IT
	IPCFR.	T2,			;GET THE ACK FROM QUASAR
	  SKIPA				;CAN'T
	JRST	RCVA.A			;ENTER COMMON CODE
	CAXN	T2,IPCUP%		;OUT OF CORE ?
	N$FATE<NEC>,,<Not enough core to receive acknowledgement>
	N$FATE<ARF>,,<Acknowledgement receive failed>

RCVA.A:	SKIPN	DEBUGW			;DEBUGGING?
	JRST	RCVA.0			;NO
	MOVE	T2,.IPCI0(M)		;GET POSSIBLE CODE WORD
	CAMN	T2,[MAKNAM,,.IPCIW]	;AND CHECK IT
	POPJ	P,			;RETURN NOW ON A MATCH
RCVA.0:	MOVE	T2,ACKCOD		;GET ACK CODE WE'RE EXPECTING
	CAME	T2,.MSCOD(M)		;IS IT?
	JRST	RCVACK			;NO, IGNORE IT
	LOAD	T2,.MSFLG(M)		;GET THE MESSAGE STATUS WORD
	TXNE	T2,MF.NOM		;NORMAL "ACK" (NO MESSAGE ASSOCIATED)
	  JRST	RCVA.3			;YES, SEE IF IT IS TIME TO RETURN
	TXNE	T2,MF.MOR		;FIRST OF MANY
	  JRST	RCVACK			;NO, THROW THIS AWAY

	;CONTINUED ON THE NEXT PAGE
	;CONTINUED FROM THE PREVIOUS PAGE

RCVA.4:	TXNN	T2,MF.FAT!MF.WRN	;FATAL OR WARNING
	JRST	RCVA.2			;NEITHER
	MOVEI	T3,"?"			;FATAL CHARACTER
	TXNN	T2,MF.FAT		;WAS IT FATAL?
	  MOVEI	T3,"%"			;NO, LOAD WARNING CHARACTER
	OUTCHR	T3			;OUTPUT THE "?" OR "%"
	OUTSTR	[ASCIZ/QSR/]		;OUTPUT "QUASAR" PREFIX
	LOAD	T3,.MSFLG(M),MF.SUF	;GET THE MESSAGE SUFFIX
	HRLZS	T3			;INTO THE OTHER SIDE FOR TTYSIX
	PUSHJ	P,TTYSIX		;OUTPUT THE FULL ERROR CODE
	MOVEI	T3," "			;GET ALIGNMENT CHARACTER
	OUTCHR	T3			;MAKE THE OUTPUT PRETTY
RCVA.2:	OUTSTR	.OHDRS+ARG.DA(M)	;AND FINALLY, OUTPUT THE MESSAGE
	PUSHJ	P,TTCRLF		;END THE MESSAGE
	TXNE	T2,MF.FAT		;AGAIN, WAS IT FATAL
	  JRST	RCVA.5			;YES, QUIT NOW
RCVA.3:	TXNE	T2,MF.MOR		;MORE COMING
	  JRST	RCVACK			;YES, DO THIS ALL OVER AGAIN
	POPJ	P,			;CONTINUE PROCESSING
RCVA.5:	EXIT	1,			;EXIT AFTER THE OUTPUT
	N$FATE<CNC>,,<Can't CONTINUE -- try REENTER>

;TTY OUTPUT SUBROUTINES
;
TTCRLF:	OUTSTR	[BYTE (7) .CHCRT, .CHLFD, 0]
	POPJ	P,

TTYSIX:	MOVE	T4,[POINT 6,T3]		;THE INITIAL BYTE POINTER
TYSIX1:	ILDB	P1,T4			;GET A CHARACTER
	JUMPE	P1,CPOPJ		;STOP AT A NULL (BLANK)
	ADDI	P1," "			;ASCII-IZE IT
	OUTCHR	P1			;DUMP IT OUT
	TLNE	T4,770000		;END OF THE WORD
	  JRST	TYSIX1			;NO, GET ANOTHER
	POPJ	P,			;ALL DONE

CPOPJ:	POPJ	P,			;RETURN.

SUBTTL MAKNAM Subroutine to Make Up the Packet to Send to INFO

;LOOK FOR [USER-NAME]QUASAR
;
MAKNAM:	PUSH	P,T3			;SAVE SOME REGS
	PUSH	P,T4			;
	SKIPL	T2,DEBUGW		;GET AND CHECK DEBUGW
	TLNN	T2,377777		;IF SET ASSUME WE GOT A PPN IN THERE
	GETPPN	T2,			;GET THE PPN
	  JFCL				;INFAMOUS SKIP RETURN
	MOVEI	T1,SHTMSG+1		;AREA TO CLEAR
	HRLI	T1,-1(T1)		;BLT POINTER
	SETZM	SHTMSG			;
	BLT	T1,SHTMSG+FBAREA-1	;CLEAR IT
	MOVE	T1,[MAKNAM,,.IPCIW]	;GET INFO FUNCTION
	MOVEM	T1,SHTMSG+.IPCI0	;STORE IT
	SETZM	SHTMSG+.IPCI1		;NO ONE TO COPY
	MOVEI	T1,SHTMSG+.IPCI2	;GET LOCATION TO PUT NAME INTO
	HRLI	T1,(POINT 7,)		;MAKE IT A POINTER
	MOVEI	T3,"["			;OPEN BRACKET
	IDPB	T3,T1			;STORED
	PUSH	P,T2			;SAVE THE PPN
	HLRZ	T3,T2			;GET THE PROJ NUMBER
	PUSHJ	P,OCTNAM		;OUTPUT IT
	MOVEI	T2,","			;SEPARATING COMMA
	IDPB	T2,T1			;STORE IT
	POP	P,T3			;RESTORE THE PPN
	ANDI	T3,-1			;ONLY PROG NUMBER
	PUSHJ	P,OCTNAM		;ADD TO THE NAME
	MOVE	T3,[POINT 7,[ASCIZ /]QUASAR/]] ;END OF NAME
MAKN.1:	ILDB	T4,T3			;GET A BYTE
	IDPB	T4,T1			;STORE THE BYTE
	JUMPN	T4,MAKN.1		;REPEAT , INCLUDING NULL
	HRRZS	T1			;ISOLATE THE ADDRESS
	SUBI	T1,SHTMSG-1		;GET LENGTH
	HRLI	T1,SHTMSG		;WHERE THE PACKET STARTS
	MOVSS	T1			;GET LEN,,ADDR
	POP	P,T4			;RESTORE ACS USED
	POP	P,T3
	POPJ	P,			;AND RETURN

OCTNAM:	IDIVI	T3,8			;OCTAL DIVIDE ROUTINE
	HRLM	T4,0(P)			;USUAL ROUTINE
	SKIPE	T3			;DONE?
	PUSHJ	P,OCTNAM		;NO GO AGAIN
	HLRZ	T3,0(P)			;GET A DIGIT
	ADDI	T3,"0"			;ASCII-IZE IT
	IDPB	T3,T1			;STORE IT
	POPJ	P,			;AND RETURN

SUBTTL	DFDEST and DFPROC Routines

;DFDEST - DEFAULT /DEST TO USER LOCATION
;
DFDEST:	MOVE	T3,S.DEST		;GET /DEST FROM USER
	CAME	T3,[-1]			;SEE IF DEFAULT NEEDED
	 POPJ	P,			;NO--RETURN
	MOVSI	T3,'OPR'		;YES--FIND HIS LOGICAL OPR
	WHERE	T3,			;ASK MONITOR
	 SETOM	T3			;NO NETWORK SUPPORT
	MOVEM	T3,S.DEST		;STORE /DEST
	POPJ	P,			;AND RETURN

;DFPROC - DEFAULT /PROC TO CENTRAL SITE
;
DFPROC:	MOVE	T3,S.PROC		;GET /PROC FROM USER
	CAME	T3,[-1]			;SEE IF DEFAULT NEEDED
	 POPJ	P,			;NO--RETURN
	MOVSI	T3,'CTY'		;YES--FIND HIS CENTRAL SITE
	WHERE	T3,			;ASK MONITOR
	 SETOM	T3			;NO NETWORK SUPPORT
	MOVEM	T3,S.PROC		;STORE /PROC
	POPJ	P,			;AND RETURN
SUBTTL	SETNOD Routine to Convert/Default a node Name/Number

SETNOD:	CAME	T1,[-1]			;DID WE DEFAULT IT TO -1.
	TLNN	T1,600000		;   OR IS THE NUMBER BINARY ???
	POPJ	P,			;YES,,RETURN NOW.
	MOVE	T4,T1			;SAVE THE NODE NAME/NUMBER
	SETZM	T2			;ZERO A WORK AC
	ROTC	T1,6			;GET 6 BITS IN T2
	CAIGE	T2,'0'			;IS IT A NUMBER ???
	JRST	SETN.4			;NO,,SEND THE GUY AN ERROR MSG
	CAILE	T2,'7'			;IS IT OCTAL ???
	JRST	SETN.3			;NO,,GO CHECK FOR ALPHA
	SETZM	T4			;ZERO ANOTHER WORK AC
SETN.1:	SUBI	T2,'0'			;MAKE THE NUMBER BINARY
	LSH	T4,3			;MAKE ROOM FOR IT IN T4
	ADD	T4,T2			;ADD IT IN
	SETZM	T2			;ZERO THE AC AGAIN
	ROTC	T1,6			;GET ANOTHER 6 BITS
	JUMPE	T2,SETN.2		;DONE???,,SAVE IT AND RETURN
	CAIL	T2,'0'			;VALIDATE THE
	CAILE	T2,'7'			;NUMBER.......
	JRST	SETN.4			;NO GOOD,,GEN AN ERROR
	JRST	SETN.1			;ELSE CONTINUE ON
SETN.2:	SKIPE	T1,T4			;ANY NUMBER YET?
	 POPJ	P,			;YES--RETURN
	MOVSI	T1,'CTY'		;NO--CONVERT 0
	WHERE	T1,			;INTO CENTRAL SITE
	 SETOM	T1			;LOSE
	POPJ	P,			;AND RETURN
SETN.3:	CAIL	T2,'A'			;IS IT VALID ALPHA ??
	CAILE	T2,'Z'			;HERE ALSO
SETN.4:	N$FATE	<INS>,,<Invalid Node Specified>
SETN.5:	SETZM	T2			;ZERO THE WORK AC
	ROTC	T1,6			;GET ANOTHER 6 BITS
	JUMPE	T2,SETN.6		;NO MORE,,STOP
	CAIL	T2,'0'			;IS IT LESS THEN 0
	CAILE	T2,'Z'			;OR GREATER THEN Z
	JRST	SETN.4			;YES,,THEN AN ERROR
	CAILE	T2,'9'			;OR IS IT BETWEEN 9
	CAIL	T2,'A'			;AND 'A' ???
	JRST	SETN.5			;NO,,KEEP ON GOING
	JRST	SETN.4			;ELSE THERE IS AN ERROR
SETN.6:	MOVEI	T3,2			;GET ARG BLOCK LENGTH
	MOVE	T1,[XWD	.NDRNN,T3]	;NAME TO NUMBER FUNCTION
	NODE.	T1,			;CONVERT THE NODE NAME
	  JRST	SETN.7			;CAN'T, CHECK FOR ANF SOFTWARE
	POPJ	P,			;RETURN, NODE NUMBER IN T1
SETN.7:	CAMN	T1,[XWD	.NDRNN,T3]	;AC UNCHANGED ???
	N$FATE	<DSI>,,<DESTINATION SWITCH ILLEGAL>;YES, NO ANF SUPPORT
	MOVE	T1,T4			;GET NAME IN T1, LET QUASAR CONVERT
	POPJ	P,			;RETURN
SUBTTL	GCORE  Subroutine

;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

SUBTTL GTTABS GETTAB Subroutines

;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,,.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
SUBTTL GTCLIN Command Scanning Subroutines

;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
;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,MI.DMT		;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,MI.DMT		;MAKE SURE IT'S SMALL ENOUGH
	JRST	E.SVTL			;NO--GIVE ERROR
	IOR	N,T2			;COMBINE FLAGS
	PJRST	.SWDPB##		;GO STORE RESULT

;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

;HERE ON /UNIT OR /STREAM SWITCH
;
UNITSW:	PUSHJ	P,.TIALT##		;GET NEXT CHARACTER
	MOVE	T1,C			;COPY IT
	PUSHJ	P,.REEAT##		;AND BACKUP ONE
	CAIL	C,"0"			;RANGE
	CAILE	C,"7"			; CHECK
	JRST	UNITYP			;GO PROCESS UNIT TYPE
	PUSHJ	P,.SWOCT##		;GET THE SWITCH VALUE
	HRLI	N,%PHYCL		;MARK AS PHYSICAL DEVICE
	MOVEM	N,S.ATTR		;SAVE IN ATTRIBUTE WORD
	SETZM	S.UNTY			;CLEAR OUT POSSIBLE UNIT TYPE
	JRST	.SWDON##		;RETURN WITHOUT STORE
UNITYP:	PUSHJ	P,.SIXSW##		;GET SIXBIT QUANTITY
	MOVEM	N,S.UNTY		;SAVE UNIT TYPE
	JRST	.SWDON##		;RETURN WITHOUT STORE
;HERE ON /QUEUE SWITCH
;
IFN FTDQS,<				;ONLY IF DQS VERSION
QNMSW:	PUSHJ	P,.TIALT##		;PRINT THE PUMP
	PUSHJ	P,.TICQT##		;CHECK FOR QUOTING
	SETZM	.NMUL##			;CLEAR ACCUMULATOR
	MOVE	T1,[.NMUL##,,.NMUL##+1]
	BLT	T1,.NMUE##
	HRROI	T1,.T8STR##		;SET ASCII STRING FORMAT
	MOVEM	T1,.LASWD##		; FOR ERROR PRINTING
	MOVE	T1,[POINT 8,.NMUL##]	;INITIALIZE BYTE POINTER
QNMSW1:	SKIPLE	.QUOTE##		;SEE IF IN QUOTED STRING
	JRST	QNMSW2			;YES--JUST GO STORE
	CAIE	C,.CHCNV		;IF SUPERQUOTE
	SKIPN	.VQUOT##		;OR SUPER-QUOTED
	JRST	QNMSW2			;THEN PASS THE CHARACTER
	PUSHJ	P,.TICAN##		;SEE IF LEGITIMATE ALPHA-NUMERIC
	  SKIPA				;NO
	JRST	QNMSW2			;YES
	CAIE	C,"$"			;CHECK OTHER LEGAL ONES
	CAIN	C,"_"			;VAX COMPATIBILITY
	JRST	QNMSW2			;GOOD
	PJRST	.SWDPB##		;GO STORE RESULT

QNMSW2:	CAMN	T1,[POINT 8,.NMUE##,31]	;SEE IF OVERFLOW
	N$FATE	<OVF>,,<Input string exceeds the size of input buffer>
	IDPB	C,T1			;NO--STORE
	PUSHJ	P,.TIALT##		;GET NEXT CHARACTER
	JRST	QNMSW1			;LOOP BACK TO PROCESS IT
>; END IFN FTDQS
DEFINE	SWTCHS,<

	XLIST
	SP ACCOUNT,S.ACCT,ACCTSW,,FS.VRQ
	SP AFTER,S.AFT,.SWDTF##,AFT,FS.VRQ!FS.NFS
	SN ALLFILES,S.ALLF
	SL ASSISTANCE,S.ASST,ASST,ASSTYES
	SL *BATLOG,S.BATL,BATL,BATLAPPEND
	SP BATOPT,S.BATO,.SWSIX##,,FS.VRQ!FS.NFS
	SP BEGIN,F.STRT,.SWDEC##,STR,FS.VRQ
	SP CARDS,S.LCDP,.SWDEC##,CDP,FS.VRQ!FS.NFS!FS.LRG
IFN FTDQS,<
	SP CHARACTERISTICS,<POINT <^D65-CHRSIZ>,S.CHAR>,.SWASQ##,,FS.VRQ
>; END IFN FTDQS
	SN *CHECK,S.CHK,FS.NFS
	SP COPIES,<POINTR(F.MOD,FP.FCY)>,.SWDEC##,COP,FS.VRQ
	SP CORE,S.COR,.SWCOR##,COR,FS.LRG!FS.VRQ
	SS CREATE,S.OPN,.QORCR
	SN DEFERRED,S.DFR
	SS DELETE,<POINTR(F.MOD,FP.DSP)>,DISPDELETE
	SP DEPENDENCY,S.DPN,DEPSW,DPN,FS.VRQ
	SP DESTINATION,S.DEST,.SWSIX##,NOD,FS.VRQ
	SL DISPOSE,<POINTR(F.MOD,FP.DSP)>,DISP,DISPPRESERVE
	SP DISTRIBUTION,<POINT 55,S.DIST>,.SWAS8##,,FS.VRQ
	SS ERBINARY,<POINTR(F.MOD,FP.OKB)>,0
	SS *FAST,S.LIST,LISTFAST
	SP FEET,S.LPTP,.SWDEC##,PTP,FS.LRG
	SL FILE,<POINTR(F.MOD,FP.FFF)>,FILE,FILEASCII
	SP FONT,<POINT <^D65-FNMLTH>,F.FONT>,.SWASQ##,,
IFE FTDQS,<
	SP FORMS,S.FRM,.SWSIX##,,FS.VRQ
>; END IFN FTDQS
IFN FTDQS,<
	SP FORMS,<POINT <^D65-FRMSIZ>,S.FRM>,.SWSXQ##,,FS.VRQ
>; END IFN FTDQS
	SS GENERIC,S.ATTRIB,<INSVL.(%GENRC,RO.ATR)>,FS.LRG
	SN HEADER,<POINTR(F.MOD,FP.NFH)>
	SP JOBNAME,S.JOB,.SWSIX##,,FS.VRQ
	SS KILL,S.OPN,.QORKL
	SP LIMIT,S.LIM,.SWDEC##,LIM,FS.LRG
	SS LOWERCASE,S.ATTRIB,<INSVL.(%LOWER,RO.ATR)>,FS.LRG
	SL *LIST,S.LIST,LIST,LISTJOBS
	SP METERS,S.LPTP,METESW,PTP,FS.LRG
	SS *MODIFY,S.OPN,.QORMD
	SN NEW,<POINTR(F.MOD,FP.NEW)>
	SP NOTES,<POINT 63,S.NOT>,.SWSXQ##,,FS.VRQ
	SN NOTIFY,S.NTF
	SN NULL,S.NULL
	SS OKBINARY,<POINTR(F.MOD,FP.OKB)>,1
	SL OUTPUT,S.OUT,OUTP,INPLOG
	SP PAGES,S.LLPT,.SWDEC##,LPT,FS.LRG
	SP PATH,DEFFIL,.SWFIL##,PTH,FS.VRQ
	SL PLOT,<POINTR(F.MOD,FP.FPF)>,PLOT,PLOTIMAGE
	SS PRESERVE,<POINTR (F.MOD,FP.DSP)>,DISPPRESERVE
	SL PRINT,<POINTR(F.MOD,FP.FPF)>,PRIN,PRINARROW
	SP PRIORITY,S.PRI,.SWDEC##,PRI
	SP PROCESSING,S.PROC,.SWSIX##,NOD,FS.VRQ
	SL PUNCH,<POINTR(F.MOD,FP.FPF)>,PUNC,PUNCASCII
IFN FTDQS,<
	SP QUEUE,<POINT <^D65-QNMLEN>,S.QNM>,QNMSW,,FS.VRQ
>; END IFN FTDQS
	SN READER,S.RDR
IFN FTDQS,<
	SN REMOTE,S.RMT
>; END IFN FTDQS
	SP REPORT,<POINT 63,F.RPT>,.SWSXQ##,,FS.VRQ
	SP REQUESTID,S.RID,.SWDEC##,RID
	SN RESTARTABLE,S.RSTR
	SP SEQUENCE,S.SEQ,.SWDEC##,SEQ
	SS SITGO,S.ATTRIB,<INSVL.(%SITGO,RO.ATR)>,FS.LRG
	SP STREAM,S.ATTRIB,UNITSW,UNT
	SL *SPACING,<POINTR(F.MOD,FP.FSP)>,SPAC,SPACSINGLE
	SP TAG,F.STRT,.SWSIX##,,FS.VRQ!FS.NFS
	SL TAPE,<POINTR(F.MOD,FP.FPF)>,TAPE,TAPEASCII
	SP TIME,S.LTIM,TIMESW,TIM,FS.LRG
	SP TPLOT,S.LPLT,.SWDEC##,PLT,FS.LRG
	SL *UNIQUE,S.UNIQ,UNIQ,UNIQYES
	SP UNIT,S.ATTRIB,UNITSW,UNT
	SS UPPERCASE,S.ATTRIB,<INSVL.(%UPPER,RO.ATR)>,FS.LRG
	SP USERNAME,<POINT 55,S.USER>,.SWAS8##,,FS.VRQ

	LIST
>
;NOW BUILD THE TABLES FROM THE SWTCHS MACRO

	DOSCAN(SWTCH)

;KEY WORD VALUES

KEYS	ASST,<YES,NO>

KEYS	BATL,<APPEND,SUPERSEDE,SPOOL>

KEYS	DISP,<PRESERVE,RENAME,DELETE>

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

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

KEYS	OUTP,<NOLOG,LOG,ERROR>

KEYS	PLOT,<IMAGE,ASCII,BINARY>

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

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

KEYS	SPAC,<SINGLE,DOUBLE,TRIPLE>

KEYS	TAPE,<ASCII,IMAGE,IBINARY,BINARY>

KEYS	UNIQ,<0,NO,1,YES>
SUBTTL 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),<
	SIXBIT	/A/
>

QUENMA:	SIXBIT	/ALL/			;FOR LISTING ONLY
QUENMT:	QUEUES
	QUENML==.-QUENMT
SUBTTL 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

SUBTTL	ACCTSW Scan ACCOUNT Switch Processing Routine

ACCTSW:	PUSHJ	P,.SWASQ##
	MOVE	T3,S.ACCT		;HAS ACCOUNT STRING BEEN SPECIFIED ??
	CAME	T3,[-1]			;IF -1 THEN ITS OK
	POPJ	P,			;IF NOT -1 THEN ALREADY SET !!!
	SETZM	S.ACCT			;RESET THE ACCOUNT FLAG
	MOVE	T3,[POINT 7,.NMUL##]
	MOVE	T4,[POINT 7,S.ACCT]
	MOVEI	P1,^D39			;MAX # OF CHARACTERS IN ACCT STRING
ACCTS1:	ILDB	P2,T3
	JUMPE	P2,.POPJ1		;NOTE THAT VALIDATION IS DONE LATER
	CAIGE	P2,176			;NO. CHECK FOR ILLEGAL CHARACTERS
	CAIGE	P2," "
ACCTS2:	N$FATE	<ICS>,<N>,<Illegal Character Specified in /ACCOUNT Switch>
	IDPB	P2,T4
	SOJGE	P1,ACCTS1
	JRST	ACCTS2			;TOO MANY CHARACTERS
SUBTTL RDX60W Input Time Subroutines

; Input a time. Legal formats are /TIME:seconds or /TIME:hh:mm:ss
; Call:	PUSHJ	P,RDX60W
;
; On return, N:= time
;
RDX60W:	PUSHJ	P,.SAVE2##		;SAVE OUR P1 AND P2
	SETZB	P1,P2			;CLEAR COUNTER, RESULT

RDX6.1:	PUSHJ	P,.DECNW##		;GET A NUMBER
	JUMPL	N,RDX6.2		;CHECK FOR ILLEGAL NUMBERS
	CAILE	N,^D60			;A REASONABLE NUMBER?
	JRST	RDX6.4			;NO - MUST HAVE GIVEN TIME IN SECONDS
	IMULI	P2,^D60			;SHIFT SOME
	ADDI	P2,(N)			;ADD IN FIELD
	CAIE	C,":"			;FIELD SEPARATOR?
	JRST	RDX6.3			;NO - MUST BE END OF TIME SPEC
	CAIG	P1,2			;TOO MANY FIELDS?
	AOJA	P1,RDX6.1		;NO - GET ANOTHER FIELD

RDX6.2:	N$FATE	<IFT>,,<Illegal format in time specification>
RDX6.3:	SKIPA	N,P2			;GET RESULT
RDX6.4:	SKIPN	P1			;CHECK FOR BAD TIME COMPONENT
	POPJ	P,			;RETURN
	N$FATE	<TCT>,<D>,<Time component too large>
SUBTTL	Fatal Error Message Routines

;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 Description

	XLIST			;LITERALS
	LIT
	LIST

	SWSEG			;SWITCH TO LOW SEG

LOWFWA:!			;START OF LOW DATA AREA
SAVCOR:	BLOCK	1		;INITIAL VALUE OF LOW SEG CORE SIZE
MADFIL:	BLOCK	1		;WE DUMMIED UP A FILESPEC FLAG
STRTOF:	BLOCK	1		;STARTING ADDRESS OFFSET

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		;LAST STICKY REPORT NAME
P.FONT:	BLOCK	FNMLTH		;LAST STICKY FONT NAME (30 CHARS MAX)
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		;/REPORT KEY
F.FONT:	BLOCK	FNMLTH		;FONT NAME (30 CHARS MAX)
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

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
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
O.LZER==.-O.ZER

L.OPEN:	BLOCK	3		;LISTING FILE OPEN BLOCK
L.LOOK:	BLOCK	LN$ENT		;LISTING FILE LOOKUP BLOCK
L.PATH:	BLOCK	.PTMAX		;LISTING FILE PATH BLOCK
L.DSKC:	BLOCK	LN$DSK		;LISTING FILE DSKCHR BLOCK
L.OTYO:	BLOCK	1		;LISTING FILE OLD TYPE OUT ROUTINE
L.STAT:	BLOCK	1		;LISTING FILE CHANNEL STATUS
L.PNTR:	BLOCK	1		;LISTING FILE BYTE POINTER TO LIST MESSAGE

PTHFCN:	BLOCK	.PTMAX	;PATH. ARGS
PTHPPN=PTHFCN+.PTPPN

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

PTHBLK:	BLOCK	.PTMAX		;MORE PATH SPACE

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
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

LSTQUE:	BLOCK	1		;BITS FOR QUEUE TO LIST
LSTNOD:	BLOCK	1		;NODE NAME FOR QUEUE TO LIST
LSTUNT:	BLOCK	1		;UNIT NUMBER FOR QUEUE TO LIST
LSTUTY:	BLOCK	1		;UNIT TYPE
T.EZER:!

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

QSRPID: BLOCK	1		;PID OF SYSTEM QUASAR
INFPID: BLOCK	1		;PID OF SYSTEM INFO
RTYCNT: BLOCK	1		;RETRY COUNTER WHEN SEND TO QUASAR FAILS
FSTMSG: BLOCK	1		;ADDR OF FIRST LISTANSWER OR CREATE MESSAGE
NUMANS: BLOCK	1		;NUMBER RECEIVED OR TO BE SENT
ACKCOD: BLOCK	1		;ACKCOD FOR KEEPING IN SYNCH
FDCSTR:	BLOCK	1		;CONTROL FILE STRUCTURE
STRBLK: BLOCK	5		;AREA FOR DETERMINING STR FROM UNIT
SHTMSG: BLOCK	FBAREA		;USED TO SEND/RECEIVE "SHORT" MESSAGES

EZCOR==.-1			;END OF AREA TO ZERO
	PHASE	.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.FONT:!BLOCK	FNMLTH		;FONT NAME (30 CHARS MAX)
I.LZER::!

	DEPHASE

	END	QUEUE