Google
 

Trailing-Edge - PDP-10 Archives - BB-D868D-BM - language-sources/oprqsr.mac
There are 40 other files named oprqsr.mac in the archive. Click here to see a list.
TITLE	OPRQSR	ORION MODULE TO PROCESS QUASAR MESSAGES
	SUBTTL	Murray Berkowitz	8 Oct 79

;
;
;                COPYRIGHT (c) 1975,1976,1977,1978,1979
;                    DIGITAL EQUIPMENT CORPORATION
;
;     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	GLXMAC,ORNMAC,QSRMAC
	PROLOG(OPRQSR)
	ERRSET			;INITIALIZE ERROR TABLES
	PARSET			;SETUP PARSER ENTRIES


	QSREDT==:43		;OPRQSR EDIT NUMBER

	EXTERNAL G$ARG1		;ARGUMENT 1
	EXTERNAL G$ARG2		;ARGUMENT 2
	EXTERNAL G$ARG3		;ARGUMENT 3
	EXTERNAL G$OPRA		;OPR ADDRESS
	EXTERNAL G$ERR		;ERROR FLAG WORD
	EXTERNAL SNDQSR		;SEND TO QUASAR
	EXTERNAL OPRENB		;OPR ENABLED
	EXTERNAL MOVARG		;MOVE AN ARGUMENT
	EXTERNAL CHKWHL		;CHECK FOR WHEEL CAPABILITY

	ENTRY	BLDOBJ		;BUILD OBJECT BLOCK
	ENTRY	ARGRTN		;SETUP ARGUMENT IN MESSAGE
	ENTRY	CMDEND		;COMMAND END PROCESSING

	COMMENT \

	THIS MODULE CONTAINS MOST OF THE MESSAGE PROCESSING FOR QUASAR.
	REVISION HISTORY

1	OPRQSR	Dec-5-78	Add Check for Remote Nodes and add node
				Block in Quasar Messages
2	OPRQSR	Dec-5-78	Add /SHORT AND /ALL FOR SHOW QUEUES
3	OPRQSR	Dec-7-78	Add New Format for HOLD,RELEASE,MODIFY,
				SHOW STATUS AND PARAMETERS
4	OPRQSR	Dec-8-78	Add GETTAP for the -10
5	OPRQSR	Jan-5-78	Add /SHORT to SHOW STATUS and /NODE to
				SHOW QUEUE command
6	OPRQSR	JAN-10-78	USE ONLY NODE NAME WHEN DEFAULTING OBJECT
				BLOCK FOR -10 AND -20
7	OPRQSR	JAN-19-79	ADD LIMITED EXCEEDED ACTION AND PRIORITY
				SETTING FOR CDP,PLT,PTP
10	OPRQSR	JAN-23-79	ADD -20 SETJOB CODE
11	OPRQSR	JAN-24-79	ADD SET ONLINE COMMAND FOR THE -20
12	OPRQSR	JAN-31-79	ALLOW REQUEUE FOR CDP,PLT , AND PTP
13	OPRQSR	FEB-2-79	CHANGE SHOW STA TAPE DEV FORM SHO STA DEV
14	OPRQSR	FEB-6-79	ADD DN60 DEFINE, SET AND SHUTDOWN COMMANDS
15	OPRQSR	Feb-27-79	Change Mount Command to be MOUNT STRUCTURE
				then Structure name.
16	OPRQSR	MAR-1-79	ADD SET TAPE INITIALIZE COMMAND
17	OPRQSR	MAR-7-79	Add Bytes Per Message for DN60 and Unlabeled
				as a label type
20	OPRQSR	Mar-14-79	Fix Cancel bug
21	OPRQSR	Mar-19-79	Send Node Numbers in Object Block on the -10
				using symbol NOD.NX. (name on the -20)
22	OPRQSR	Mar-26-79	Add IDENTIFY Command  and remove Tape stuff from
				the MOUNT command
23	OPRQSR	Apr-5-79	Check Privileges on SET Job Command
24	OPRQSR	Apr-8-79	Add Message on SET JOB commands
25	OPRQSR	Apr-10-79	Add Support for new SHOW options for TAPE and
				DISK
26	OPRQSR	Apr-12-79	Add SWITCH Command for the -20
27	OPRQSR	Apr-23-79	Add Scheduler Commands for the -20
30	OPRQSR	May-2-79	Fix SHOW STATUS <OBJECT> to only show remote 
				Nodes
31	OPRQSR	May-8-79	Add SHOW STATUS/PARAMETERS OF NETWORK-NODES
				and START Node command
32	OPRQSR	Jun-12-79	Remove AC PB from this module
33	OPRQSR	Jul-9-79	Remove the MOUNT command
34	OPRQSR	Jul-10-79	Fix Suppres Bug
35	OPRQSR	Jul-11-79	Remove the UNLOAD command and add new DISMOUNT
				command
36	OPRQSR	Jul-24-79	Fix SET DISK ... UNAVAILABLE
37	OPRQSR	Aug-9-79	Allow SHUTDOWN node without DN60 support
40	OPRQSR	Aug-23-79	Add SET NODE SIGNON and NO-SIGNON-REQUIRED
				for DN60
41	OPRQSR	Sept-12-79	Support Terminals and Tapes on START command
				with /DEVICE
42	OPRQSR	Oct-8-79	Add LOCK,UNLOCK and ENABLE/DISABLE ASR
				Also add SHOW STATUS STRUCTURE Command
43	OPRQSR	Oct-8-79	Backspace and Forwardspace /FILE no longer
				require or accept a number.
\
	SUBTTL	Table of Contents

;               TABLE OF CONTENTS FOR OPRQSR
;
;
;                        SECTION                                   PAGE
;    1. Murray Berkowitz        12 Apr 79.........................   1
;    2. Table of Contents.........................................   3
;    3. STOP(PAUSE),CONTINUE AND SHUTDOWN MESSAGES................   3
;    4. START COMMAND.............................................   3
;    5. ARGRTN  --      ARGUMENT HEADER AND BUMP ROUTINE..........   4
;    6. CMDEND  --      FINISH COMMAND MESSAGE AND SEND IT........   5
;    7. BLDOBJ  --      BUILD AN OBJECT BLOCK.....................   6
;    8. FINOBJ  --      FINISH OBJECT BLOCK AFTER TYPE FIELD......   6
;    9. FORWARDSPACE/BACKSPACE Commands...........................   7
;   10. LPTOBJ  --      LINE PRINTER OBJECT SETUP.................   7
;   11. ALIGN COMMAND.............................................   8
;   12. SUPPRESS Command..........................................   9
;   13. CANCEL  --      CANCEL COMMAND PROCESSING.................  10
;   14. PREQNM  --      Process /REQUEST ROUTINE..................  11
;   15. PREASN  --      Process /REASON ROUTINE...................  11
;   16. PUSER   --      PROCESS USER BLOCK........................  11
;   17. REQUEUE COMMAND PROCESSING................................  12
;   18. ROUTE COMMAND.............................................  13
;   19. HOLD AND RELEASE COMMANDS.................................  14
;   20. PQTYPE  --      PROCESS QUEUE TYPE FIELD..................  14
;   21. PNODSW  --      PROCESS NODE SWITCH.......................  15
;   22. CNODSW  --      VALIDATE THE NODE SWITCH..................  15
;   23. GNODSW  --      GET NODE SWITCH IF PRESENT................  15
;   24. Q$DELETE        --      DELETE QUEUE ENTRIES..............  16
;   25. CHKRMT  --      CHECK FOR REMOTE NODE INPUT...............  17
;   26. Q$MODIFY        --      Modify Queue Entry Command........  18
;   27. SET     --      PROCESS THE SET COMMAND...................  19
;   28. SETJOB  --      SET OPERATOR VALUES FOR A JOB.............  20
;   29. SETPGL,SETFRM,SETLEA,SETOPL...............................  21
;   30. SETMEM,SETPRI,SETTIM AND OPERATOR ACTION..................  21
;   31. SETONL  --      SET ONLINE COMMAND FOR THE -20............  22
;   32. SETSCH  --      SET SCHEDULER FOR THE -20.................  23
;   33. SETNOD  --      SET NODE COMMAND FOR DN60.................  24
;   34. SETDSK  --      SET DISK COMMAND FOR -20..................  25
;   35. SETTAP  --      SET TAPE COMMAND FOR -20..................  26
;   36. PSTAPE  --      PROCESS TAPE DRIVE BLOCK..................  27
;   37. PSTRUC  --      PROCESS STRUCTURE BLOCK...................  27
;   38. PVOLID  --      PROCESS VOLUME ID BLOCK...................  27
;   39. SETINI  --      SET INITIALIZE COMMAND FOR TAPES..........  28
;   40. SETDEN  --      SET TAPE INIT DENSITY.....................  29
;   41. SETLBT  --      SET THE LABEL TYPE........................  29
;   42. SETOVR  --      SET TAPE INIT OVERIDE FUNCTION............  29
;   43. SETOWN  --      SET TAPE INIT OWNER.......................  30
;   44. SETPRO  --      SET THE PROTECTION FOR THE TAPE...........  30
;   45. SETCNT  --      SET THE COUNT MULTIPLE INITIALIZATION.....  30
;   46. SETINC  --      SET INCREMENT FOR NEXT VOLUME-ID..........  30
;   47. SETSVI  --      SET STARTING VOLUME NUMBER................  30
;   48. SETTDP  --      SET THE TAPE DISPOSITION WHEN DONE........  30
;   49. SETVID  --      SETUP VOLUME ID...........................  31
;   50. TABSRC  --      TABLE SEARCH ROUTINE......................  32
;   51. GETTAP  --      GET A TAPE DEVICE.........................  33
;   52. SETSTR  --      SET STRUCTURE COMMAND FOR -20.............  34
;   53. Q$SHWS  --      SHOW STATUS ROUTINE.......................  35
;   54. Q$SHWP  --      SHOW PARAMETERS ROUTINE...................  35
;   55. PROSHW  --      PROCESS SHOW STATUS AND SHOW PARAMETERS...  36
;   56. SHWTAP  --      SHOW TAPE STATUS..........................  37
;   57. SHWDSK  --      SHOW STATUS DISK DRIVES...................  38
;   58. Q$SHWQ  --      SHOW QUEUES COMMAND.......................  39
;   59. Q$SHWC  --      SHOW CONTROL FILE COMMAND.................  40
;   60. Q$DISMOUNT      --      DISMOUNT COMMAND FOR THE -20......  41
;   61. Q$RECOGNIZE     --      RECOGNIZE COMMAND FOR THE -10.....  41
;   62. Q$UNLOAD        --      UNLOAD COMMAND FOR TAPES..........  41
;   63. Q$ETAPE --      ENABLE TAPE COMMAND.......................  42
;   64. Q$DTAPE --      DISABLE TAPE COMMAND......................  42
;   65. Q$MOUNT --      MOUNT TAPE AND DISK COMMAND...............  43
;   66. Q$IDENTIFY      --      IDENTIFY COMMAND FOR TAPES........  44
;   67. Q$DEFINE        --      DEFINE COMMAND FOR D60............  45
;   68. Q$SWITCH        --      SWITCH COMMAND FOR THE -20........  46

	SUBTTL	STOP(PAUSE),CONTINUE AND SHUTDOWN MESSAGES
	;THIS ROUTINE WILL SEND THE APPROPRIATE OBJECT BLOCK TO QUASAR
	;FOR THE DESIRED FUNCTION..
	;THE ROUTINE IS CALLED WITH S1 CONTAINING THE MESSAGE TYPE

Q$SHUTDN::
	PUSHJ	P,BLDOBJ		;BUILD THE OBJECT
	JUMPT	CMDEND			;FINISH OFF COMMAND
	PUSHJ	P,P$KEYW		;CHECK FOR KEYWORD
	JUMPF	.POPJ			;ERROR..RETURN
	CAIE	S1,.KYNOD		;WAS IT A NODE
	$RETF				;BAD COMMAND
	PUSHJ	P,CHKWHL		;IS THE PROCESS ENABLED
	JUMPF	E$IPE			;INSUFFICIENT PRIVILEGES
	PUSHJ	P,P$NODE		;WAS IT A NODE?
	JUMPF	.POPJ			;NO..ERROR
	PUSHJ	P,SAVNOD		;SAVE THE NODE
	PJRST	CMDEND			;END THE COMMAND

Q$CONTIN:: 
Q$PAUSE:: PUSHJ	P,BLDOBJ		;BUILD AN OBJECT BLOCK
	JUMPF	.POPJ			;RETURN FALSE BACK UP
	PJRST	CMDEND			;CHECK FOR END AND SEND MESSAGE


	SUBTTL	START COMMAND

	;THE START COMMAND IS THE SAME AS THE SHUTDOWN, CONTINUE AND
	;PAUSE(STOP) COMMANDS EXCEPT THAT THE START COMMAND FOR PRINTERS
	;CAN HAVE AN OPTIONAL DEVICE FIELD.


Q$START:: PUSHJ	P,Q$SHUTDN		;PROCESS THE FIRST PART
	JUMPT	.POPJ			;O.K..COMMAND FINISHED
	MOVE	S1,ARG.DA+.OHDRS+OBJ.TY(MO)	;GET THE OBJECT TYPE
	CAIE	S1,.OTLPT		;IS IT A PRINTER?
	$RETF				;NO..INVALID MESSAGE
	PUSHJ	P,P$SWIT		;IS THERE A SWITCH?
	JUMPF	.POPJ			;NO..INVALID COMMAND
	CAIE	S1,.SWDEV		;WAS IT DEVICE?
	$RETF				;NO..ERROR
	LOAD	S1,OBJ.UN+ARG.DA+.OHDRS(MO),OU.HRG	;GET HIGH RANGE
	SKIPE	S1			;CHECK IF THERE  IS ONE
	PJRST	E$RNA			;RANGE NOT ALLOWED IN START /DEVICE
	PUSHJ	P,P$DEV			;GET DEVICE BLOCK
	JUMPF	.POPJ			;RETURN FALSE
	DMOVE	T1,S1			;SAVE THE ARGUMENTS
	PUSHJ	P,GETDES		;GET THE DEVICE DESIGNATOR
	JUMPF	E$IDS			;NO..ERROR..RETURN
TOPS10<	TXNN	S2,DV%MTA!DV%TTY>	;TAPE OR TTY?
TOPS20<	CAIE	S2,DV%MTA		;IS IT A TAPE
	CAIN	S2,DV%TTY		;IS IT A TTY
	SKIPA				;O.K.
>;END TOPS20
	PJRST	E$IDS			;INVALID DEVICE SPECIFIED
	DMOVE	S1,T1			;RESTORE THE ARGUMENTS
	MOVX	T1,.CMDEV		;TAPE DEVICE BLOCK
	STORE	T1,ARG.HD(S1),AR.TYP	;SAVE THE TYPE
	PUSHJ	P,MOVARG		;MOVE THE ARGUMENT
	PJRST	CMDEND			;NO CHECK FOR END AND RETURN
	SUBTTL	ARGRTN	--	ARGUMENT HEADER AND BUMP ROUTINE

	;THIS ROUTINE WILL SETUP THE ARGUMENT HEADER FROM THE
	;TYPE IN S1 AND THE LENGTH IN S2. IT WILL ALSO ADVANCE P3 TO NEXT 
	;LOCATION IN MESSAGE AND BUMP ARGUMENT COUNT FOR MESSAGE

ARGRTN:	STORE	S1,ARG.HD(P3),AR.TYP	;SAVE THE TYPE FIELD
	STORE	S2,ARG.HD(P3),AR.LEN	;SAVE THE LENGTH
	AOS	.OARGC(MO)		;BUMP ARGUMENT COUNT
	ADD	P3,S2			;BUMP TO NEXT FREE LOCATION
	$RETT				;O.K...RETURN TRUE
	SUBTTL	CMDEND	--	FINISH COMMAND MESSAGE AND SEND IT

	;THIS ROUTINE WILL CHECK FOR END OF COMMAND AND IF O.K
	;PREPARE MESSAGE TO BE SENT TO QUASAR

CMDEND:	PUSHJ	P,P$CFM			;CHECK FOR CONFIRM
	JUMPF	.POPJ			;NO..INVALID MESSAGE
	ANDI	P3,777			;GET MESSAGE LENGTH
	STORE	P3,.MSTYP(MO),MS.CNT	;SAVE MESSAGE SIZE IN MESSAGE
	PJRST	SNDQSR			;SEND THE MESSAGE TO QUASAR
	SUBTTL	BLDOBJ	--	BUILD AN OBJECT BLOCK
	SUBTTL	FINOBJ	--	FINISH OBJECT BLOCK AFTER TYPE FIELD

	;THIS ROUTINE WILL BUILD AN OBJECT BLOCK FOR A MESSAGE TO AN
	;OBJECT PROCESSOR AND PLACE IT IN THE MESSAGE POINTED TO BY
	;MO
BLDOBJ:	PUSHJ	P,P$KEYW		;GET A KEYWORD
	JUMPF	.POPJ			;NOT A KEYWORD..INVALID..RETURN	
	CAILE	S1,.OTMAX		;LESS THAN OR EQUAL VALID OBJECT
	JRST	BLDO.6			;INVALID TYPE..RETURN
	CAIE	S1,.OTBAT		;WAS IT A BATCH BLOCK
	JRST	BLDO.1			;NO..IGNORE CHECK
	MOVE	P1,S1			;SAVE THE NUMBER
	PUSHJ	P,CHKWHL		;CHECK FOR WHEEL OR OPERATOR
	JUMPF	E$BNR			;BATCH COMMANDS MUST BE LOCAL
	MOVE	S1,P1			;GET THE TYPE BACK
BLDO.1:	STORE	S1,ARG.DA+OBJ.TY(P3)	;SAVE THE TYPE
FINOBJ:	SETZM	ARG.DA+OBJ.UN(P3)	;ZERO THE UNIT NUMBER FIELDS
	PUSHJ	P,P$NUM			;GET A NUMBER
	JUMPF	.POPJ			;RETURN FALSE..PASSING RETURN UP
	STORE	S1,ARG.DA+OBJ.UN(P3),OU.LRG	;SAVE AS LOW RANGE
	MOVE	P1,S1			;SAVE THE LOW RANGE
	PUSHJ	P,P$TOK		;CHECK FOR TOKEN AND RANGE
	JUMPF	BLDO.2			;NO..CHECK FOR NODE
					;IGNORE TOKEN
	PUSHJ	P,P$NUM			;GET THE OTHER NUMBER
	JUMPF	.POPJ			;INVALID FIELD..NUMBER NEEDED
	CAML	P1,S1			;CHECK FOR VALID RANGE
	PJRST	E$IRS			;UNITS OUT OF RANGE
	STORE	S1,ARG.DA+OBJ.UN(P3),OU.HRG	;SAVE THE HIGH RANGE
BLDO.2:	ZERO	ARG.DA+OBJ.ND(P3)	;INITIALIZE NODE FIELD
	PUSHJ	P,P$SWIT		;GET A SWITCH
	JUMPF	BLDO.4			;NOT A SWITCH,,CHECK CONFIRM
	CAIE	S1,.SWNOD		;WAS IT A NODE
	JRST	BLDO.3			;NO..SETUP NODE VALUE IN BLOCK
	PUSHJ	P,P$NODE		;GET THE NODE
	JUMPF	BLDO.3			;GET NODE FROM NODE ENTRY
	MOVE	P1,S1			;SAVE THE NODE DATA
	PUSHJ	P,OPRENB		;CHECK IF OPERATOR ENABLED FOR NODE
	JUMPF	.POPJ			;NO..RETURN..NOT A VALID NODE
	PJRST	BLDO.5			;SAVE NODE AND RETURN
BLDO.3:	PUSHJ	P,P$PREV		;POSITION TO THE PREVIOUS ONE
					;ON INPUT
BLDO.4:	MOVE	T1,G$OPRA		;GET OPERATOR ENTRY ADDRESS
	MOVE	T1,OPR.ND(T1)		;GET NODE ADDRESS
	MOVE	P1,NOD.NX(T1)		;GET NODE NAME ON -20
BLDO.5:	STORE	P1,ARG.DA+OBJ.ND(P3)	;SAVE THE NODE NAME
	MOVX	S1,.OROBJ		;TYPE OF DATA ELEMENT..OBJ BLOCK
	MOVX	S2,.OBJLN		;SIZE OF THE BLOCK
	PJRST	ARGRTN			;SETUP HEADER,COUNT, POINTER..RETT
BLDO.6:	PUSHJ	P,P$PREV		;POSITION TO THE PREVIOUS ONE
	$RETF				;RETURN FALSE
SUBTTL	FORWARDSPACE/BACKSPACE Commands

Q$FSPACE::
Q$BSPACE:: PUSHJ	P,LPTOBJ		;LINE PRINTER OBJECT SETUP
	JUMPF	.POPJ			;ERROR..RETURN
	PUSHJ	P,P$SWIT		;GET A SWITCH
	JUMPF	.RETF			;ILLEGALLY FORMATTED COMMAND
	MOVEI	S2,FSPDSP		;GET TABLE ADDRESS
	PUSHJ	P,TABSRC		;GET THE VALUE
	JUMPF	.POPJ			;ERROR..RETURN
	MOVE	T2,S2			;PLACE TYPE IN T2
	PUSHJ	P,P$NUM			;GET A NUMBER
	JUMPF	[CAIE T2,.SPFIL		;Was it /FILE?
		 POPJ	P,		;No..return the failure
		 MOVEI S1,1		;Yes..argument is 1 file
		 JRST .+1]		;Continue..
	STORE	S1,ARG.DA(P3)		;SAVE DATA IN MESSAGE
	MOVE	S1,T2			;GET TYPE IN S1
	MOVEI	S2,ARG.SZ		;SIZE OF THE BLOCK
	PUSHJ	P,ARGRTN		;ARG HEADER,COUNT ROUTINE
	PJRST	CMDEND			;CHECK FOR END AND SEND MESSAGE

FSPDSP:	$STAB
	.SWPAG,,.SPPAG			;PAGES
	.SWFIL,,.SPFIL			;FILES
	.SWCPY,,.SPCPY			;COPIES
	$ETAB

	SUBTTL	LPTOBJ	--	LINE PRINTER OBJECT SETUP

	;THIS ROUTINE WILL SETUP AN OBJECT BLOCK AND MAKE SURE
	;THAT IT IS FOR A LINE PRINTER WITH ONLY ONE UNIT SPECIFIED.
	;THE OBJECT BLOCK WILL BE BUILT IN THE OUTPUT MESSAGE

LPTOBJ:	PUSHJ	P,BLDOBJ		;AND AN OBJECT BLOCK
	JUMPF	.POPJ			;ERROR..PASS CODE UP
	MOVEI	T1,.OHDRS+ARG.DA(MO)	;POINT TO OBJECT BLOCK
	LOAD	S1,OBJ.UN(T1),OU.HRG	;SEE IF WE HAVE A NON-ZERO HIGH UNIT
	JUMPN	S1,.RETF		;LOSE IF SO
	LOAD	S1,OBJ.TY(T1)		;GET MESSAGE TYPE
	CAXE	S1,.OTLPT		;PRINTER?
	$RETF				;NO, LOSE
	$RETT				;RETURN TRUE
	SUBTTL	ALIGN COMMAND

	;THIS ROUTINE WILL PROCESS AN ALIGN COMMAND FROM OPR

Q$ALGN:: PUSHJ	P,LPTOBJ		;SETUP LINE PRINTER OBJECT BLOCK
	JUMPF	.POPJ			;ERROR..RETURN
	PUSHJ	P,P$SWIT		;CHECK FOR A SWITCH
	JUMPF	ALIG.3			;NO..CHECK FOR A FILE
	CAIE	S1,.SWSTP		;WAS IT A STOP
	JRST	ALIG.2			;NO..TRY OTHER VALUES
	MOVX	S1,.ALSTP		;GET THE STOP ARGUMENT TYPE
	MOVEI	S2,1			;SETUP FIELD LENGTH
	PUSHJ	P,ARGRTN		;SETUP ARGUMENT IN MESSAGE
	PJRST	CMDEND			;FINISH OFF THE COMMAND
ALIG.1:	PUSHJ	P,P$SWIT		;GET A SWITCH
	JUMPF	ALIG.3			;CHECK FOR A FILE
ALIG.2:	MOVEI	S2,ALIDSP		;GET ALIGN TABLE
	PUSHJ	P,TABSRC		;CHECK THE TABLE
	JUMPF	.POPJ			;ERROR..RETURN
	MOVE	T2,S2			;SAVE THE VALUE
	PUSHJ 	P,P$NUM			;GET A NUMBER
	JUMPF	.POPJ			;ERROR..RETURN
	STORE	S1,ARG.DA(P3)		;SAVE NUMBER IN ARGUMENT BLOCK
	MOVEI	S2,ARG.SZ		;GET ARGUMENT SIZE
	MOVE	S1,T2			;GET  FUNCTION TYPE
	PUSHJ	P,ARGRTN		;SAVE THE ARGUMENT AND UPDATE COUNTERS
	JRST	ALIG.1			;CHECK NEXT FIELD
ALIG.3:	PUSHJ	P,P$IFIL		;CHECK FOR INPUT FILE
	JUMPF	CMDEND			;NO..CHECK FOR END OF COMMAND
	PUSHJ	P,MOVARG		;YES..MOVE FD AND HEADER FOR OUTPUT
	JRST	ALIG.1			;CHECK THE NEXT FIELD

ALIDSP:	$STAB
	.SWRPT,,.ALRPT			;REPEAT COUNT
	.SWPAU,,.ALPAU			;PAUSE COUNT
	$ETAB
SUBTTL	SUPPRESS Command
Q$SUPPRE:: PUSHJ	P,LPTOBJ	;SETUP LINE PRINTER OBJECT BLOCK
	JUMPF	.POPJ			;ERROR..RETURN
	PUSHJ	P,P$SWIT		;CHECK FOR A SWITCH
	MOVEI	S2,SUPDSP		;ADDRESS OF THE TABLES
	SKIPT				;SKIP IF O.K.
	MOVEI	S1,.SWJOB		;ASSUME JOB AS DEFAULT
	PUSHJ	P,TABSRC		;SEARCH THE TABLE
	JUMPF	.POPJ			;ERROR..RETURN
	MOVE	S1,S2			;PLACE TYPE IN S1
	MOVEI	S2,1			;LENGTH OF ARGUMENT IN S2
	PUSHJ	P,ARGRTN		;SAVE THE ARGUMENT
	PJRST	CMDEND			;FINISH THE COMMAND

SUPDSP:	$STAB
	.SWFIL,,.SUPFL			;FILE
	.SWJOB,,.SUPJB			;JOB
	.SWSTP,,.SUPST			;STOP
	$ETAB
	SUBTTL	CANCEL	--	CANCEL COMMAND PROCESSING

	;THIS ROUTINE WILL PROCESS A CANCEL COMMAND AND SEND THE 
	;APPROPRIATE MESSAGE TO QUASAR

Q$CANCEL:: PUSHJ	P,BLDOBJ		;GET AN OBJECT BLOCK SETUP
	JUMPF	.POPJ			;NO..RETURN..BAD MESSAGE
	MOVEI	T1,.OHDRS+ARG.DA(MO)	;ADDRESS OF ARGUMENT BLOCK
	LOAD	S1,OBJ.UN(T1),OU.HRG	 ;GET HIGH RANGE
	JUMPN	S1,.RETF		;NON-ZERO..RETURN FALSE
CANC.1:	PUSHJ	P,P$SWIT		;GET A SWITCH IF ANY
	JUMPF	CMDEND			;NO..CHECK FOR CONFIRM AND SEND
	CAIE	S1,.SWREQ		;/REQUEST NUMER SWITCH
	JRST	CANC.3			;PROCESS SEQUENCE SWITCH
	PUSHJ	P,PREQNM		;PROCESS REQUEST NUMBER
	JUMPF	.POPJ			;ERROR RETURN
CANC.2:	PUSHJ	P,P$SWIT		;CHECK FOR SWITCH
	JUMPF	CMDEND			;ERROR..CHECK FOR END
CANC.3:	MOVEI	S2,CANDSP		;CANCEL TABLE ADDRESS
	PUSHJ	P,TABSRC		;SEARCH THE TABLE
	JUMPT	CANC.4			;O.K..CONTINUE ON
	CAIN	S1,.SWRSN		;/REASON SWITCH
	JRST	CANC.5			;PROCESS REASON SWITCH
	$RETF				;INVALID COMMAND
CANC.4:	MOVEM	S2,ARG.DA(P3)		;SAVE THE DATA FIELD
	MOVX	S1,.CANTY		;GET CANCEL TYPE
	MOVX	S2,ARG.SZ		;GET ARGUMENT SIZE
	PUSHJ	P,ARGRTN		;SETUP ARGUMENT HEADER AND COUNTS
	JRST	CANC.2			;GET NEXT FIELD
CANC.5:	PUSHJ	P,PREASN		;PROCESS THE REASON SWITCH
	JUMPF	.POPJ			;NO...ERROR..RETURN
	PJRST	CMDEND			;CHECK FOR COMMAND END AND RETURN

CANDSP:	$STAB
	.SWPUR,,.CNPRG			;/PURGE
	.SWERR,,.CNERR			;/ERROR
	.SWNER,,.CNNER			;/NOERROR
	$ETAB
	SUBTTL	PREQNM	--	Process /REQUEST ROUTINE


	;PROCESS /REQUEST SWITCH

PREQNM:	PUSHJ	P,P$NUM			;GET A NUMBER
	JUMPF	.POPJ			;NO..RETURN FALSE
PREQ.1:	STORE	S1,ARG.DA(P3)		;SAVE THE NAME IN MESSAGE
	MOVX	S1,.ORREQ		;GET JOBNAME TYPE
	MOVX	S2,ARG.SZ		;SIZE OF THE ARGUMENT
	PJRST	ARGRTN			;SETUP ARGUMENT HEADER AND COUNTS


	SUBTTL	PREASN	--	Process /REASON ROUTINE
	;PROCESS /REASON TEXT DATA


PREASN:	PUSHJ	P,P$TEXT		;GET A TEXT ARGUMENT
	JUMPF	.POPJ			;NO..RETURN
	MOVX	T1,.ORREA		;GET REASON TYPE
	STORE	T1,ARG.HD(S1),AR.TYP	;SAVE CORRECT TYPE IN HEADER
	PUSHJ	P,MOVARG		;BUILD TEXT ARGUMENT AND UPDATE COUNTS
	$RETT				;RETURN TRUE

	SUBTTL	PUSER	--	PROCESS USER BLOCK

PUSER:	PUSHJ	P,P$USER		;GET USER DATA
	JUMPF	.POPJ			;ERROR..RETURN
	MOVEM	S1,ARG.DA(P3)		;SAVE THE DATA
	MOVX	S1,.CMUSR		;GET USER TYPE
	MOVX	S2,ARG.SZ		;SIZE OF THE ARGUMENT
	PJRST	ARGRTN			;SAVE THE ARGUMENT
	SUBTTL	REQUEUE	COMMAND PROCESSING

	;THIS ROUTINE WILL ANALYSZE A REQUEUE COMMAND AND SEND THE 
	;APPROPRIATE MESSAGE TO QUASAR

Q$REQUE::	PUSHJ	P,BLDOBJ		;SETUP OBJECT BLOCK
	JUMPF	.POPJ			;ERROR IF NOT SETUP..RETURN
	MOVEI	T1,.OHDRS+ARG.DA(MO)	;GET THE ARGUMENT BLOCK
	LOAD	S1,OBJ.UN(T1),OU.HRG	;GET HIGH VALUE
	JUMPN	S1,.RETF		;RANGE NOT ALLOWED
	MOVE	P1,OBJ.TY(T1)		;GET THE TYPE FIELD
REQU.1:	PUSHJ	P,P$SWIT		;GET A SWITCH
	JUMPF	REQU.5			;NO..CHECK FOR OTHER FIELDS
	CAIE	S1,.SWREQ		;CHECK FOR REQUEST
	JRST	REQU.3			;YES..PROCESS JOBNAME
	PUSHJ	P,PREQNM		;PROCESS REQUEST NUMBER
	JUMPF	.POPJ			;ERROR RETURN
REQU.2:	PUSHJ	P,P$SWIT		;CHECK FOR SWITCH
	JUMPF	REQU.5			;CHECK OTHER FIELDS
REQU.3:	CAIN	S1,.SWRSN		;CHECK FOR REASON 
	JRST	REQU.4			;PROCESS REASON SWITCH
	$RETF				;INVALID COMMAND..RETURN
REQU.4:	PUSHJ	P,PREASN		;PROCESS THE REASON FLAG
	JUMPF	.POPJ			;ERROR..RETURN
	JRST	REQU.7			;CHECK FOR A CONFIRM
REQU.5:	CAIN	P1,.OTBAT		;CHECK FOR BATCH
	JRST	REQU.7			;YES..CHECK FOR A CONFIRM
	PUSHJ	P,P$KEYW		;PRINTER..CHECK FOR KEYWORD
	SETOM	T1			;SETUP FLAG FOR SWITCHES
	JUMPF	REQU.8			;CHECK FOR END OF MESSAGE
	CAIE	S1,.KYBEG		;BEGINNING-OF KEYWORD
	JRST	REQU.6			;CHECK FOR CURRENT POSITION
	PUSHJ	P,P$KEYW		;GET BEGINNING OPRION
	JUMPF	.POPJ			;NOT..KEYWORD..ERROR
	CAIN	S1,.KYCPY		;IS IT COPY 
	MOVEI	T1,.RQBCP		;BEGINNING OF COPY
	CAIN	S1,.KYJOB		;IS IT JOB
	MOVEI	T1,.RQBJB		;BEGINNING OF JOB
	CAIN	S1,.KYFIL		;IS IT FILE
	MOVEI	T1,.RQBFL		;BEGINNING OF FILE
REQU.6:	CAIN	S1,.KYCUR		;CURRENT-POSITION
	MOVEI	T1,.RQCUR		;CURRENT  POSITION
	JUMPL	T1,.RETF		;INVALID KEYWORD
	STORE	T1,ARG.DA(P3)		;SAVE VALUE IN MESSAGE
	MOVX	S1,.REQTY		;KEY ARGUMNET BLOCK TYPE
	MOVX	S2,ARG.SZ		;GET ARGUMENT SIZE
	PUSHJ	P,ARGRTN		;SETUP ARGUMENT AND COUNTS
	PUSHJ	P,P$SWIT		;GET A SWITCH
	JUMPF	REQU.7			;CHECK FOR CONFIRM
	CAIE	S1,.SWRSN		;IS IT REASON
	$RETF				;RETURN FALSE
	JRST	REQU.4			;PROCESS THE REASON SWITCH
REQU.7:	PJRST	CMDEND			;FINISH THE COMMAND
REQU.8:	CAIE	S1,.CMCFM		;CHECK IF AT END OF COMMAND
	$RETF				;NO..RETURN FALSE
	MOVEI	S1,.KYCUR		;SET DEFAULT FOR CURRENT POSITION
	JRST	REQU.6			;FINISH COMMAND
	SUBTTL	ROUTE COMMAND

	;THIS ROUTINE WILL SEND A ROUTE MESSAGE TO QUASAR
Q$ROUTE:: PUSHJ	P,P$NODE		;GET A NODE FIELD
	JUMPF	.POPJ			;NOT A NODE..RETURN
	MOVEM	S1,ARG.DA(P3)		;SAVE THE NODE VALUE
	PUSHJ	P,OPRENB		;IS OPR ENABLED FOR NODE
	JUMPF	.POPJ			;NO..RETURN
ROUT.1:	PUSHJ	P,P$NODE		;GET THE OTHER NODE
	JUMPT	ROUT.2			;O.K. CONTINUE ON
	PUSHJ 	P,P$KEYW		;GET A KEYWORD
	JUMPF	.POPJ			;ERROR RETURN
	CAIE	S1,.KYTO		;WAS IT TO
	$RETF				;NO..BAD COMMAND
	JRST	ROUT.1			;TRY NODE NOW
ROUT.2:	MOVEM	S1,ARG.DA+1(P3)		;SAVE THE NODE
	MOVX	S1,.ORRTN		;GET THE NODE FUNCTION
	MOVX	S2,ARG.SZ+1		;SIZE OF THE BLOCK
	PUSHJ	P,ARGRTN		;SAVE THE ARGUMENT
	PJRST	CMDEND			;END THE COMMAND
	SUBTTL	HOLD AND RELEASE COMMANDS

Q$RELEASE::
Q$HOLD::	PUSHJ	P,CHKRMT		;CHECK IF FROM REMOTE AND ADD
					;NODE BLOCK IF IS FOR QUASAR VALIDATION
	PUSHJ	P,P$KEYW		;GET THE KEYWORD
	JUMPF	.POPJ			;NO..ERROR...RETURN
HOLD.1:	PUSHJ	P,PQTYPE		;PROCESS QUEUE TYPE
	JUMPF	.POPJ			;ERROR..RETURN
HOLD.2:	PUSHJ	P,PREQNM		;PROCESS REQUEST NUMBER
	JUMPF	HOLD.3			;ERROR..TRY USER FIELD
	PJRST	CMDEND			;CHECK FOR THE END
HOLD.3:	PUSHJ	P,PUSER			;PROCESS USER FIELD
	JUMPF	HOLD.4			;CHECK OUT * OR /NODE
	PJRST	CMDEND			;END THE MESSAGE
HOLD.4:	PUSHJ	P,P$TOK			;GET A TOKEN
	JUMPF	.POPJ			;ERROR ..RETURN
	SETOM	S1			;YES..ASSUME * -1 FOR REQUEST
	PUSHJ	P,PREQ.1		;SAVE ARGUMENT
	PUSHJ	P,PNODSW		;GET NODE SWITCH
	JUMPF	.POPJ			;ERROR .. RETURN
	PJRST	CMDEND			;FINISH OFF COMMAND

	SUBTTL	PQTYPE	--	PROCESS QUEUE TYPE FIELD

	;CALLED WITH S1 CONTAINING THE QUEUE TYPE

PQTYPE:	MOVEM	S1,G$ARG1		;SAVE THE OBJECT TYPE
	SKIPG	S1			;VALID QUEUE TYPE
	PJRST	E$IOT			;INVALID OBJECT TYPE
	CAILE	S1,.OTPLT		;WITHIN RANGE
	PJRST	E$IOT			;NO..INVALID OBJECT TYPE
PQTY.1:	MOVEM	S1,ARG.DA(P3)		;SAVE THE OBJECT TYPE IN MESSAGE
	MOVX	S1,.ORTYP		;GET OBJECT TYPE
	MOVX	S2,ARG.SZ		;GET ARGUMENT SIZE
	PJRST	ARGRTN			;SAVE ARGUMENT AND RETURN
	SUBTTL	PNODSW	--	PROCESS NODE SWITCH
	SUBTTL	CNODSW	--	VALIDATE THE NODE SWITCH

PNODSW:	PUSHJ	P,P$SWIT		;CHECK FOR A SWITCH
	JUMPF	.RETT			;RETURN O.K..CHECK NEXT FIELD
	CAIE	S1,.SWNOD		;WAS IT A NODE
	$RETF				;NO..RETURN FALSE
CNODSW:	PUSHJ	P,P$NODE		;GET THE NODE FIELD
	JUMPF	.POPJ			;ERROR..RETURN
	MOVE	P1,S1			;SAVE VALUE OF NODE
	PUSHJ	P,OPRENB		;IS OPR ENABLED FOR NODE
	JUMPF	.POPJ			;ERROR...RETURN
	MOVE	S1,P1			;PLACE IN S1
SAVNOD:	MOVEM	S1,ARG.DA(P3)		;SAVE THE VALUE
	MOVX	S1,.ORNOD		;GET THE NODE BLOCK TYPE
	MOVX	S2,ARG.SZ		;AND BLOCK SIZE
	PJRST	ARGRTN			;SAVE ARGUMENT AND RETURN

	SUBTTL	GNODSW	--	GET NODE SWITCH IF PRESENT

	;THIS ROUTINE WILL GET NODE SWITCH IF PRESENT AND RETURN VALUE
	;IN S1 OR  RETURN FALSE IF NOT THERE

GNODSW:	PUSHJ	P,P$SWIT		;CHECK FOR A SWITCH
	JUMPF	.POPJ			;NOT..RETURN FALSE
	CAIE	S1,.SWNOD		;WAS IT A NODE
	$RETF				;NO..RETURN FALSE
	PUSHJ	P,P$NODE		;GET THE NODE FIELD
	POPJ	P,			;RETURN..PASSING CODE OR VALUE
	SUBTTL	Q$DELETE	--	DELETE QUEUE ENTRIES

Q$DELETE:: PUSHJ	P,CHKRMT	;CHECK IF FROM REMOTE AND ADD
					;NODE BLOCK IF IS FOR QUASAR VALIDATION
	PUSHJ	P,P$KEYW		;GET THE QUEUE TYPE
	JUMPF	.POPJ			;ERROR...RETURN
	CAIN	S1,.KYMNT		;WAS IT A MOUNT REQUEST
	JRST	DELE.1			;PROCESS DELETE OF MOUNT REQUESTS
	SETZM	P1			;SET FLAG FOR ALL DATA
	PJRST	HOLD.1			;FINISH OFF COMMAND
DELE.1:	MOVX	S1,.OTDMT		;SET DELETE MOUNT REQUEST TYPE
	STORE	S1,.MSTYP(MO),MS.TYP	;SAVE THE TYPE IN HEADER
	PUSHJ	P,PREQNM		;WAS IT A REQUEST NUMBER
	JUMPT	DELE.2			;PROCESS THE REASON IF PRESENT
	PUSHJ	P,PSTRUC		;GET THE STRUCTURE NAME
	JUMPF	.POPJ			;ERROR..RETURN..BAD COMMAND
DELE.2:	PUSHJ	P,P$SWIT		;WAS THERE A SWITCH
	JUMPF	CMDEND			;NO..CHECK END OF COMMAND
	CAIE	S1,.SWRSN		;WAS IT /REASON: ??
	$RETF				;NO..RETURN FALSE
	PUSHJ	P,PREASN		;PROCESS THE REASON
	JUMPT	CMDEND			;O.K  FINISH OFF MESSAGE
	POPJ	P,			;OTHERWISE PASS ERROR BACK
	SUBTTL	CHKRMT	--	CHECK FOR REMOTE NODE INPUT

	;THIS ROUTINE WILL CHECK IF FROM REMOTE SITE AND ADD A .CMNOD
	;BLOCK IF IS SO QUASAR AND VALIDATE REQUEST

CHKRMT:	PUSHJ	P,CHKWHL		;WAS THE USER PRIVILEGED
	JUMPT	.POPJ			;YES..O.K.
	MOVE	S1,G$OPRA		;GET OPERATOR ADDRESS
	MOVE	S2,OPR.ND(S1)		;GET NODE ENTRY ADDRESS
	MOVE	S1,NOD.NX(S2)		;GET THE NAME
	PJRST	SAVNOD			;SAVE A NODE
	SUBTTL	Q$MODIFY	--	Modify Queue Entry Command

	;THIS COMMAND WILL MODIFY AN ENTRY IN QUASARS QUEUES

Q$MODIFY:: PUSHJ	P,CHKRMT	;CHECK IF FROM REMOTE AND ADD
					;NODE BLOCK IF IS FOR QUASAR VALIDATION
	PUSHJ	P,P$KEYW		;GET A KEYWORD
	JUMPF	.POPJ			;ERROR..RETURN
	PUSHJ	P,PQTYPE		;PROCESS QUEUE TYPE
	JUMPF	.POPJ			;NOT..ERROR..RETURN
	PUSHJ	P,PREQNM		;PROCESS REQUEST NUMBER
	JUMPT	MODI.1			;O.K. PROCESS MODIFY OPTION
	PUSHJ	P,PUSER			;TRY USER FIELD
	JUMPT	MODI.1			;O.K.. PROCESS THE  FIELDS
	PUSHJ	P,P$TOK			;WAS THERE A TOKEN
	JUMPF	.POPJ			;NO..ERROR..RETURN
	SETOM	S1			;SET FOR ALL REQUESTS
	PUSHJ	P,PREQ.1		;SAVE REQUEST NUMBER
	PUSHJ	P,PNODSW		;WAS THERE A NODE SWITCH
	JUMPF	.POPJ			;ERROR..RETURN
MODI.1:	PUSHJ	P,P$KEYW		;PROCESS A KEYWORD
	JUMPF	.POPJ			;BAD COMMAND
	CAIE	S1,.KYPRI		;IS IT PRIORITY
	$RETF				;BAD COMMAND
	PUSHJ	P,P$NUM			;GET THE NUMBER
	JUMPF	.POPJ			;ERROR..RETURN
	MOVEM	S1,ARG.DA(P3)		;SAVE THE VALUE
	MOVX	S1,.MOPRI		;GET BLOCK TYPE
	MOVX	S2,ARG.SZ		;BLOCK SIZE
	PUSHJ	P,ARGRTN		;SAVE THE ARGUMENT
	PJRST	CMDEND			;FINISH OFF COMMAND
	SUBTTL	SET	--	PROCESS THE SET COMMAND

	;THIS ROUTINE WILL SEND THE APPROPRIATE SET MESSAGE TO
	;QUASAR FOR PRINTERS, BATCH-STREAMS, AND PRIORITY. ALL OTHER 
	;SET TYPES WILL BE PROCESSED BY ORION

Q$SET:: PUSHJ	P,P$KEYW		;GET A KEYWORD
	JUMPF	.POPJ			;ILLEGALLY FORMATTED COMMAND
	MOVSI	S2,-SETTX1		;PREPARE AOBJN POINTER
SET.1:	HLRZ	T1,SETDSP(S2)
	CAME	T1,S1			;MATCH?
	AOBJN	S2,SET.1		;CHECK THE REST IF ANY
	JUMPGE	S2,.RETF		;LOSE!
	MOVE	P2,SETDSP(S2)		;SAVE ENTRY DATA
	MOVEI	T1,SETDSP(S2)		;ADDRESS OF THE ENTRY
	CAILE	T1,SETOBJ		;SET FOR BAT OR LPT
	JRST	SET.3			;NO..GO PROCESS
	PUSHJ	P,P$PREV		;POSITION TO PREVIOUS BLOCK
	PUSHJ	P,BLDOBJ		;GET THE OBJECT BLOCK
	JUMPF	.POPJ			;RETURN
	PUSHJ	P,P$KEYW		;GET THE KEYWORD FOR SET
	JUMPF	.POPJ			;RETURN
	HRRZ	S2,P2			;GET THE PROPER TABLE ADDRESS
	MOVE	S2,(S2)			;GET DISPATCH POINTER
SET.2:	HLRZ	T1,(S2)			;GET THE FIELD TO CHECK
	CAME	T1,S1			;CHECK FOR MATCH??
	AOBJN	S2,SET.2		;NO..KEEP CHECKING
	JUMPGE	S2,.RETF		;NO MATCH..FAILED
	HRRZ	T1,(S2)			;GET ADDRESS OF HEADER
	HLRZ	T2,(T1)			;PLACE ADDRESS IN T1
	MOVE	T2,(T2)			;GET HEADER IN T1
	MOVEM	T2,ARG.HD(P3)		;SAVE THE ENTRY
SET.3:	HRRZ	S2,(T1)			;GET THE ROUTINE ADDRESS
	JRST	(S2)			;GO TO PROPER ROUTINE


	;SET COMMAND DISPATCH TABLE
SETDSP:	XWD	.KYBAT,[-BATCNT,,BATDSP]	 ;BATCH
	XWD	.KYLPT,[-LPTCNT,,LPTDSP]	 ;LPT
	XWD	.KYCDP,[-CDPCNT,,CDPDSP]	;CDP
	XWD	.KYPTP,[-PTPCNT,,PTPDSP]	;PAPAR-TAPE-PUNCH
SETOBJ:	XWD	.KYPLT,[-PLTCNT,,PLTDSP]	;PLT
	XWD	.KYJOB,SETJOB		;PROCESS JOB SETTING OPTIONS
	XWD	.KYTAP,SETTAP		;SET TAPE COMMAND
IFN	FTJSYS,<
	XWD	.KYSCH,SETSCH		;SET BIAS COMMAND
	XWD	.KYDSK,SETDSK		;SET DISK COMMAND
	XWD	.KYSTR,SETSTR		;SET STRUCTURE COMMAND
	XWD	.KYONL,SETONL		;SET ONLINE COMMAND
>;END FTJSYS
IFN	FTDN60,<
	XWD	.KYNOD,SETNOD		;SET NODE COMMAND
>;END FTDN60
SETTX1==.-SETDSP


	;BATCH DISPATCH TABLE

BATDSP:	XWD	.KYMEM,[[ARG.SZ+1,,.STMEM],,SETMEM] ;MEMORY LIMITS
	XWD	.KYPRL,[[ARG.SZ+1,,.STPRI],,SETPRI] ;PRIORITY-LIMITS
	XWD	.KYNOI,[[1,,.STNOI],,SETNOI]	;NOOPR-INTERVENTION
	XWD	.KYOIA,[[1,,.STOIA],,SETOIA]	;OPR-INTERVENTION
	XWD	.KYTIM,[[ARG.SZ+1,,.STTIM],,SETTIM] ;SET TIME LIMITS
BATCNT==.-BATDSP


	;LINE PRINTER DISPATCH TABLE

LPTDSP:	XWD	.KYFOT,[[ARG.SZ,,.STFRM],,SETFRM] ;FORMS-TYPE
	XWD	.KYLEA,[[ARG.SZ,,.STLEA],,SETLEA] ;LIMIT-EXCEED-ACTION
	XWD	.KYPGL,[[ARG.SZ+1,,.STPGL],,SETPGL] ;PAGE-LIMITS
	XWD	.KYPRL,[[ARG.SZ+1,,.STPRI],,SETPRI] ;PRIORITY-LIMITS
LPTCNT==.-LPTDSP

PLTDSP:
CDPDSP:
PTPDSP:	XWD	.KYFOT,[[ARG.SZ,,.STFRM],,SETFRM] ;FORMS-TYPE
	XWD	.KYLEA,[[ARG.SZ,,.STLEA],,SETLEA] ;LIMIT-EXCEED-ACTION
	XWD	.KYOPL,[[ARG.SZ+1,,.STOPL],,SETOPL] ;OUTPUT-LIMITS
	XWD	.KYPRL,[[ARG.SZ+1,,.STPRI],,SETPRI] ;PRIORITY-LIMITS
	CDPCNT==.-CDPDSP
	PTPCNT==.-PTPDSP
	PLTCNT=.-PLTDSP
	SUBTTL	SETJOB	--	SET OPERATOR VALUES FOR A JOB

SETJOB:	PUSHJ	P,CHKWHL		;IS THE PROCESS ENABLED
	JUMPF	E$IPE			;INSUFFICIENT PRIVILEGES
	PUSHJ	P,P$NUM			;GET A NUMBER
	JUMPF	.POPJ			;NO..ERROR..RETURN
	MOVE	P1,S1			;SAVE NUMBER IN P1
	MOVEM	P1,G$ARG1		;SAVE THE JOB NUMBER
	PUSHJ	P,P$KEYW		;GET THE SETTING KEYWORD
	JUMPF	.POPJ			;ERROR...RETURN
	MOVE	P2,S1			;SAVE KEYWORD IN P2
	PUSHJ	P,P$CFM			;COMMAND HAVE CONFIRM?
	JUMPF	SETJ.1			;TRY CLASS SETTING
	SETO	T2,			;SET A FLAG
	CAIN	P2,.KYNOI		;WAS IT NO OPERATOR INTERVENTION
	MOVEI	T2,.OBNWR		;SET NO OPR INTERVENTION
	CAIN	P2,.KYOIA		;OPR INTERVENTION ALLOWED
	MOVEI	T2,.OBALL		;YES SET OPR INTERVENTION ALLOWED
	JUMPL	T2,.RETF		;INVALID FIELD..RETURN
IFN	FTUUOS,<
	MOVE	S2,P1			;PLACE JOB NUMBER IN S2
	MOVE	S1,[2,,S2]		;SET UP THE BLOCK
	HRLI	T1,.STWTO		;SET WTO INFO FUNCTION
	HRR	T1,T2			;PLACE VALUE IN T1
	JBSET.	S1,			;PERFORM THE FUNCTION
	  PJRST	E$SJN			;SET JOB NOT IMPLEMENTED  
>;END FTUUOS

IFN	FTJSYS,<
	MOVE	S1,P1			;GET THE JOB NUMBER
	MOVX	S2,.SJBAT		;UPDATE BATCH DATA
	SETZ	T1,			;CLEAR THE DATA WORD
	STORE	T2,T1,OB%WTO		;SAVE THE DATA
	SETJB				;SET THE INFO
	 ERJMP E$SJN			;NOTE THE ERROR
>;END FTJSYS
	PJRST	E$SJM			;SET JOB MODIFIED
TOPS10 <
SETJ.1:	$RETF				;ILLEGAL COMMAND
>;END TOPS10

TOPS20	<
SETJ.1:	CAIE	P2,.KYCLS		;WAS IT CLASS?
	$RETF				;NO..INVALID COMMAND
	PUSHJ	P,P$NUM			;GET THE CLASS VALUE
	JUMPF	.POPJ			;ERROR..RETURN
	MOVE	T3,S1			;PLACE CLASS IN BLOCK
	MOVEM	T3,G$ARG2		;SAVE THE CLASS
	MOVEI	S1,.SKSCJ		;GET THE FUNCTION
	MOVEI	S2,T1			;BLOCK IN T1
	MOVEI	T1,3			;SIZE OF BLOCK
	MOVE	T2,P1			;GET THE JOB NUMBER
	SKED%				;DO THE FUNCTION
	  ERJMP	SETJ.2			;TRAP ERROR
	PJRST	E$SSJ			;SET SCHEDULER JOB O.K.
SETJ.2:	MOVE	S1,[EXP -2]		;GET LAST -20 ERROR
	MOVEM	S1,G$ARG1		;SAVE THE VALUE
	PJRST	E$SJF			;SET FAILED..RETURN
>;END TOPS20
	SUBTTL	SETPGL,SETFRM,SETLEA,SETOPL
	SUBTTL	SETMEM,SETPRI,SETTIM AND OPERATOR ACTION

SETTIM:
SETPGL:
SETOPL:
SETMEM:	PUSHJ	P,P$RNGE		;GET RANGE
	JUMPF	.POPJ			;ERROR..RETURN
SETM.1:	DMOVEM	S1,ARG.DA(P3)		;SAVE VALUES IN MESSAGE
	ADDI	P3,ARG.SZ+1		;BUMP TO NEXT FREE LOCATION
	AOS	.OARGC(MO)		;BUMP THE ARGUMENT COUNT
	PJRST	CMDEND			;FINISH OFF COMMAND

SETPRI:	PUSHJ	P,P$RNGE		;GET RANGE
	JUMPF	.POPJ			;ERROR..RETURN
	MOVEM	S2,G$ARG1		;SAVE THE VALUE
	CAILE	S2,^D63			;IS IT IN RANGE
	PJRST	E$SPI			;INVALID PRIORITY SPECIFIED
	JRST	SETM.1			;FINISH OFF COMMAND


SETNOI:
SETOIA:	ADDI	P3,1			;BUMP TO NEXT LOCATION
	AOS	.OARGC(MO)		;BUMP THE ARGUMENT COUNT
	PJRST	CMDEND			;FINISH OFF COMMAND

;HERE TO SET PRINTER PARAMETERS
SETFRM:	PUSHJ	P,P$SIXF		;GET A 6 BIT FIELD TYPE
	JUMPF	.POPJ			;ERROR..RETURN
	MOVEM	S1,ARG.DA(P3)		;SAVE FORMS NAME IN MESSAGE
	ADDI	P3,ARG.SZ		;BUMP TO NEXT LOCATION
	AOS	.OARGC(MO)		;BUMP THE ARGUMENT COUNT
	PJRST	CMDEND			;END THE COMMAND

;HERE TO HANDLE LIMIT-EXCEEDED-ACTION VERB
SETLEA:	PUSHJ	P,P$KEYW		;GET A KEYWORD
	JUMPF	.POPJ			;ERROR..RETURN
	MOVEI	S2,LEADSP		;GET LIMIT-EXCEED ACTION TABLE
	PUSHJ	P,TABSRC		;SEARCH THE TABLE
	JUMPF	.POPJ			;ERROR..RETURN
	MOVEM	S2,ARG.DA(P3)		;SAVE IN THE MESSAGE
	ADDI	P3,ARG.SZ		;BUMP THE POINTER
	AOS	.OARGC(MO)		;BUMP THE ARGUMENT COUNT
	PJRST	CMDEND			;FINISH OFF COMMAND

LEADSP:	$STAB
	.KYCNC,,.STCAN			;CANCEL IT
	.KYASK,,.STASK			;ASK
	.KYIGN,,.STIGN			;IGNORE IT
	$ETAB
	SUBTTL	SETONL	--	SET ONLINE COMMAND FOR THE -20

	;THIS COMMAND IS TO INFORM SYSTEM OF A DEVICE THAT HAS BECOME
	;AVAILABLE.

IFN	FTJSYS,<
SETONL:	PUSHJ	P,CHKWHL		;PROGRAM WHEEL OR OPERATOR
	JUMPF	E$IPE			;INSUFFIECIENT PRIVILEGES
	MOVE	P3,MO			;GET OUTPUT POINTER
	MOVEI	S1,[ASCIZ//]		;NULL TEXT
	MOVEM	S1,G$ARG1		;SAVE THE ARGUMENT
	SETOM	T4			;SET THE FLAG
SETO.1:	PUSHJ	P,P$NUM			;GET A NUMBER
	JUMPF	.POPJ			;BAD COMMAND
	MOVEM	S1,G$ARG2		;SAVE THE ARGUMENT
	SKIPGE	S1			;IS IT O.K.
	PJRST	E$SIC			;INVALID CHANNEL
	CAILE	S1,7			;IS IT IN RANGE
	PJRST	E$SIC			;SET INVALID CHANNEL
	AOS	P3			;BUMP THE FIELD
	MOVEM	S1,(P3)			;SAVE THE DATA
	PUSHJ	P,P$COMMA		;CHECK FOR A COMMA
	JUMPF	.POPJ			;ERROR..RETURN
	PUSHJ	P,P$NUM			;GET THE DEVICE NUMBER
	JUMPF	.POPJ			;ERROR..RETURN
	MOVEM	S1,G$ARG2		;SAVE DEVICE NUMBER
	SKIPGE	S1			;IS IT VALID?
	PJRST	E$SID			;INVALID DEVICE
	AOS	P3			;BUMP POINTER
	MOVEM	S1,(P3)			;SAVE THE VALUE
	PUSHJ	P,P$CFM			;CHECK IF DONE
	JUMPF	SETO.2			;TRY FOR COMMA
	AOS	P3			;BUMP FIELD
	SETOM	(P3)			;NO CONTROLLER -1 USED
	PJRST	SETO.3			;FINISH OFF COMMAND
SETO.2:	PUSHJ	P,P$COMMA		;WAS IT A COMMA?
	JUMPF	.POPJ			;BAD COMMAND
	PUSHJ	P,P$NUM			;GET CONTROLLER IF PRESENT
	JUMPF	.POPJ			;NO..ERROR..RETURN
	MOVEM	S1,G$ARG2		;SAVE THE VALUE
					;JSYS WILL VERIFY
	AOS	P3			;BUMP POINTER
	MOVEM	S1,(P3)			;SAVE THE VALUE
	PUSHJ	P,P$CFM			;CONFIRMED??
	JUMPT	SETO.3			;PROCESS IT
	AOSE	T4			;CHECK FLAG
	$RETF				;INVALID COMMAND
	MOVEI	S1,[ASCIZ/Alternate /]	;GET ALTERNATE
	MOVEM	S1,G$ARG1		;SAVE THE VALUE
	JRST	SETO.1			;GET ALTERNATE DATA
SETO.3:	MOVX	S1,.DGPDL		;GET FUNCTION CODE
	MOVEM	S1,(MO)			;SAVE IN BLOCK
	HRRZ	S1,MO			;ADDRESS IN RIGHT HALF
	SUBI	P3,-1(MO)		;GET LENGTH OF BLOCK
	MOVN	P3,P3			;MAKE IT NEGATIVE
	HRL	S1,P3			;PUT LENGTH IN LEFT HALF
	DIAG				;DO THE JSYS
	  PJRST	SETO.4			;ERROR..CHECK IT OUT
	PJRST	E$SOA			;SET ONLINE ACCEPTED.. RELEASE THE PAGE
SETO.4:	MOVEM	S1,G$ARG1		;SAVE THE ERROR CODE
	PJRST	E$DJF			;DIAG JSYS FAILED

>;END FTJSYS
	SUBTTL	SETSCH	--	SET SCHEDULER FOR THE -20


	;THIS COMMAND WILL DO THE SKED% JSYS TO AFFECT THE SCHEDULER CONTROLS
	;AND INFORM OPERATOR OF THE ACTION
IFN	FTJSYS,<

SETSCH:	PUSHJ	P,CHKWHL		;PROGRAM WHEEL OR OPERATOR
	JUMPF	E$IPE			;INSUFFIECIENT PRIVILEGES
	PUSHJ	P,P$KEYW		;GET A KEYWORD
	JUMPF	.POPJ			;ERROR..RETURN
	MOVEI	S2,SCHDSP		;SCHEDULER DISPATCH TABLE
	PUSHJ	P,TABSRC		;SEARCH THE TABLE
	JUMPF	.POPJ			;ERROR..RETURN
	HLRZ	P1,(S2)			;GET THE FUNCTION CODE
	HRRZ	S2,(S2)			;GET THE ROUTINE ADDRESS
	PJRST	(S2)			;PROCESS THE ROUTINE AND RETURN
SCHBIA:	PUSHJ	P,P$NUM			;GET THE NUMBER
	JUMPF	.POPJ			;ERROR..RETURN
	MOVEI	T1,2			;BLOCK OF 2 WORDS
	MOVE	T2,S1			;GET THE NUMBER	
	PJRST	SCHED			;DO THE FUCNTION AND RETURN


	SUBTTL	SCHED	--	SCHEDULE JSYS FOR THE -20

	;THIS ROUTINE WILL DO THE SCHEDULE FUNCTION WITH P1 CONTAINING THE
	;FUNCTION CODE

SCHED:	MOVEI	T1,2			;MINIMUM SIZE BLOCK
SCHED1:	MOVE	S1,P1			;GET THE FUNCTION
	MOVEI	S2,T1			;ADDRESS OF THE BLOCK
	SKED%				;DO THE JSYS
	  ERJMP	SCHED2			;SHOW ERROR
	PJRST	E$SSS			;BIAS SET ..RETURN AND RELEASE PAGE
SCHED2:	MOVE	S2,[EXP -2]		;LAST -20 ERROR CODE
	MOVEM	S2,G$ARG1		;SAVE THE CODE
	PJRST	E$SSF			;SET BIAS FAILED



SCHDSP:	$STAB
	.KYBAT,,[.SKBCS,,SCHBAT]	;SET SCHED BATCH
	.KYBIA,,[.SKSBC,,SCHBIA]	;SET SCHED BIAS
	.KYCLS,,[.SKSCS,,SCHCLS]	;SET SCHED CLASS
	$ETAB
>;END FTJSYS
	SUBTTL	SCHSCH	--	(Continued)

IFN	FTJSYS,<

SCHBAT:	PUSHJ	P,P$NUM			;GET THE BATCH CLASS
	JUMPF	SCHB.1			;TRY KEYWORDS
	MOVE	T2,S1			;GET THE CLASS NUMBER
	PJRST	SCHED			;DO THE SCHED JSYS
SCHB.1:	PUSHJ	P,P$KEYW		;IS IT A KEYWORD?
	JUMPF	.POPJ			;ERROR..RETURN
	CAIE	S1,.KYNON		;NONE?
	JRST	SCHB.2			;TRY BACKGROUND
	SETOM	T2			;NON-ZERO VALUE
	PUSHJ	P,SCHED			;DO THE FUNCTION
	MOVEI	P1,.SKBBG		;CLEAR DREGS SETTING ALSO
	SETZM	T2			;CLEAR THE VALUE
	PJRST	SCHED			;DO THE FUNCTION AND RETURN
SCHB.2:	CAIE	S1,.KYBCK		;WAS IT BACKGROUND
	$RETF				;NO..RETURN FALSE
	MOVEI	P1,.SKBBG		;SET BACKGROUND
	SETOM	T2			;NON-ZERO..BACKGROUND
	PJRST	SCHED			;DO THE FUNCTION
>;END FTJSYS
	SUBTTL	SCHCLS	--	SCHEDULER CLASS SETTING


IFN	FTJSYS,<
SCHCLS:	PUSHJ	P,P$NUM			;GET THE CLASS NUMBER
	JUMPF	.POPJ			;ERROR..RETURN
	MOVE	T2,S1			;SAVE THE VALUE
	PUSHJ	P,P$NUM			;GET THE PERCENT
	JUMPF	.POPJ			;ERROR..RETURN
	FLTR	S1,S1			;FLOAT THE NUMBER
	FDVRI	S1,(100.)		;CONVERT TO NUMBER FROM PERCENT
	MOVE	T3,S1			;SAVE THE SHARE
	MOVEI	T1,3			;GET THE LENGTH
	PJRST	SCHED1			;DO THE FUNCTION
>;END FTJSYS
	SUBTTL	SETNOD	--	SET NODE COMMAND FOR DN60

	;THIS COMMAND WILL PASS A PARTICULAR VALUE FOR A DN60 OPTION

IFN	FTDN60,<
SETNOD:	PUSHJ	P,CHKWHL		;PROGRAM WHEEL OR OPERATOR
	JUMPF	E$IPE			;INSUFFIECIENT PRIVILEGES
	PUSHJ	P,P$NODE		;BETTER HAVE NODE VALUE
	JUMPF	.POPJ			;ERROR..RETURN
	PUSHJ	P,SAVNOD		;SAVE THE NODE
	PUSHJ	P,P$KEYW		;CHECK FOR A KEYWORD
	JUMPF	.POPJ			;ERROR..RETURN
	MOVEI	S2,SETNDP		;GET TABLE ADDRESS
	PUSHJ	P,TABSRC		;SEARCH THE TABLE
	JUMPF	.POPJ			;ERROR..RETURN
	HLRZ	P1,(S2)			;GET BLOCK VALUE IN P1
	HRRZ	S2,(S2)			;GET ROUTINE ADDRESS
	PJRST	(S2)			;PROCESS FUNCTION AND RETURN

SETNDP:	$STAB
	XWD	.KYBPM,[.STBPM,,SETBPM]	;BYTES PER MESSAGE
	XWD	.KYCSD,[.STCSD,,SETCSD]	;CLEAR-SEND-DELAY
	XWD	.KYDTR,[.STDTR,,SETDTR]	;DATA TERMINAL READY
	XWD	.KYRPM,[.STRPM,,SETRPM]	;RECORDS PER MESSAGE
	XWD	.KYSWL,[.STSWL,,SETSWL]	;SILO WARNING LEVEL
	XWD	.KYTOU,[.STTOU,,SETTOU]	;TIMEOUT CATEGORY
	XWD	.KYTRA,[.STTRA,,SETTRA]	;TRANSPARANCY
	XWD	.KYSON,[.STSON,,SETSON]	;SIGNON-REQUIRED
	XWD	.KYNSN,[.STNSN,,SETNSN]	;NO-SIGNON-REQUIRED
	$ETAB


	;ALL ROUTINES CALLED WITH FUNCTION CODE IN P1

	;SET CLEAR TO SEND DELAY
SETBPM:
SETRPM:
SETSWL:
SETCSD:	PUSHJ	P,P$NUM			;GET THE VALUE
	JUMPF	.POPJ			;ERROR..RETURN
	MOVEM	S1,ARG.DA(P3)		;SAVE THE DATA
SETFIN:	MOVE	S1,P1			;GET THE BLOCK TYPE
	MOVX	S2,ARG.SZ		;BLOCK SIZE
	PUSHJ	P,ARGRTN		;SAVE THE ARGUMENT
	PJRST	CMDEND			;FINISH AND SEND COMMAND

SETTRA:
SETDTR:	PUSHJ	P,P$KEYW		;GET THE KEYWORD
	JUMPF	.POPJ			;ERROR..RETURN
	SETZ	T1,			;SET A FLAG
	CAIN	S1,.KYON		;WAS IT ON
	MOVX	T1,ST.ON		;SET ON
	CAIN	S1,.KYOFF		;WAS IT OFF
	MOVX	T1,ST.OFF		;SET OFF
	JUMPE	T1,.RETF		;NONE..ERROR..RETURN
	MOVEM	T1,ARG.DA(P3)		;SAVE THE VALUE
	PJRST	SETFIN			;FINISH SET COMMAND

SETTOU:	PUSHJ	P,P$KEYW		;GET THE KEYWORD
	JUMPF	.POPJ			;ERROR..RETURN
	SETZ	T1,			;SET A FLAG
	CAIN	S1,.KYPRI		;WAS IT PRIMARY
	MOVX	T1,ST.PRI		;SET PRIMARY
	CAIN	S1,.KYSEC		;WAS IT SECONDARY
	MOVX	T1,ST.SEC		;SET SECONDARY
	JUMPE	T1,.RETF		;NONE..ERROR..RETURN
	MOVEM	T1,ARG.DA(P3)		;SAVE THE VALUE
	PJRST	SETFIN			;FINISH THE COMMAND


SETSON:
SETNSN:	MOVE	S1,P1			;GET THE FUNCTION CODE
	MOVEI	S2,1			;GET THE BLOCK SIZE
	PUSHJ	P,ARGRTN		;SAVE THE ARGUMENT
	PJRST	CMDEND			;FINISH AND SEND COMMAND

>;END FTDN60
	SUBTTL	SETDSK	--	SET DISK COMMAND FOR -20

IFN	FTJSYS,<
SETDSK:	PUSHJ	P,CHKWHL		;PROGRAM WHEEL OR OPERATOR
	JUMPF	E$IPE			;INSUFFIECIENT PRIVILEGES
	MOVX	S1,.OTSDK		;SET DISK COMMAND FOR -20
	STORE	S1,.MSTYP(MO),MS.TYP	;SAVE THE TYPE IN HEADER
	PUSHJ	P,P$KEYW		;GET A KEYWORD
	JUMPF	.POPJ			;ERROR..RETURN
	CAIE	S1,.KYCHN		;WAS IT A CHANNEL
	$RETF				;NO..RETURN
	PUSHJ	P,P$NUM			;GET THE NUMBER
	JUMPF	.POPJ			;NO..ERROR
	MOVEM	S1,ARG.DA(P3)		;SAVE CHANNEL NUMBER
	MOVEM	S1,G$ARG1		;SAVE NUMBER FOR POSSIBLE ERROR
	SKIPGE	S1			;VALID CHANNEL NUMBER
	PJRST	E$ICN			;INVALID CHANNEL NUMBER
	PUSHJ	P,P$KEYW		;GET NEXT ITEM
	JUMPF	.POPJ			;BETTER BE DRIVE NUMBER
	CAIE	S1,.KYDRV		;IS IT?
	$RETF				;NO..RETURN FALSE
	PUSHJ	P,P$NUM			;GET DRIVE NUMBER
	JUMPF	.POPJ			;NO..ERROR..RETURN
	MOVEM	S1,ARG.DA+1(P3)		;SAVE THE DRIVE NUMBER IN BLOCK
	MOVEM	S1,G$ARG1		;SAVE NUMBER IN CASE OF ERROR
	SKIPGE	S1			;IS IT VALID
	PJRST	E$DDI			;DISK DRIVE INVALID
	MOVX	S1,.DSKDV		;DISK DRIVE BLOCK
	MOVEI	S2,3			;3 WORDS
	PUSHJ	P,ARGRTN		;SAVE THE ARGUMENT
	PUSHJ	P,SETAVL		;GET SET AVALIABLE FUNCTION
	JUMPT	CMDEND			;END THE COMMAND AND SEND TO QUASAR
	POPJ	P,			;RETURN PASSING ERROR UP

>;END FTJSYS

SETAVL:	PUSHJ	P,P$KEYW		;GET A KEYWORD
	JUMPF	.POPJ			;ERROR..RETURN
	SETOM	T1			;FLAG FOR CHECKING VALUES
	CAIN	S1,.KYAVA		;AVAILABLE?
	MOVX	T1,.DVAVL		;SET DEVICE AVAILABLE BLOCK
	CAIN	S1,.KYUAV		;UNAVAILABLE?
	MOVX	T1,.DVUAV		;SET DEVICE UNAVAILABLE
	SKIPGE	T1			;IS ONE SET
	$RETF				;NO..ERROR..RETURN
	MOVE	S1,T1			;BLOCK TYPE IN 1
	MOVEI	S2,1			;BLOCK SIZE OF 1
	PUSHJ	P,ARGRTN		;SAVE THE BLOCK
	CAIE	T1,.DVUAV		;UNAVAILABLE??
	$RETT				;NO..RETURN TRUE
	PUSHJ	P,PREASN		;PROCESS THE REASON
	POPJ	P,			;PASS THE RETURN BACK
	SUBTTL	SETTAP	--	SET TAPE COMMAND FOR -20

SETTAP:	PUSHJ	P,CHKWHL		;PROGRAM WHEEL OR OPERATOR
	JUMPF	E$IPE			;INSUFFIECIENT PRIVILEGES
	MOVX	S1,.OTSTP		;SET TAPE COMMAND FOR -20
	STORE	S1,.MSTYP(MO),MS.TYP	;SAVE THE TYPE IN HEADER
	PUSHJ	P,PSTAPE		;PROCESS TAPE DEVICE
	JUMPF	.POPJ			;ERROR..RETURN
	PUSHJ	P,SETAVL		;SETUP AVAILABLE,UNAVAILABLE BLOCK
	JUMPT	CMDEND			;O.K.. FINISH THE COMMAND
	PJRST	SETINI			;TRY INITIALIZE
	SUBTTL	PSTAPE	--	PROCESS TAPE DRIVE BLOCK

	;THIS ROUTINE WILL CHECK FOR A DEVICE AND A TAPE DRIVE AND
	;SAVE A .TAPDV BLOCK IN THE MESSAGE

PSTAPE:	PUSHJ	P,P$DEV			;GET DEVICE BLOCK
	JUMPF	.POPJ			;RETURN FALSE
PSTA.1:	PUSHJ	P,GETTAP		;GET A TAPE DEVICE
	JUMPF	.POPJ			;NO..ERROR..RETURN
	MOVX	T1,.TAPDV		;TAPE DEVICE BLOCK
	STORE	T1,ARG.HD(S1),AR.TYP		;SAVE THE TYPE
	PJRST	MOVARG			;MOVE THE BLOCK AND RETURN


	SUBTTL	PSTRUC	--	PROCESS STRUCTURE BLOCK

	;THIS ROUTINE WILL SAVE A STRUCTURE BLOCK IN THE MESSAGE

PSTRUC:	PUSHJ	P,P$DEV			;GET THE DEVICE
	JUMPF	.POPJ			;ERROR..RETURN
	MOVX	T1,.STRDV		;STRUCTURE TYPE
	STORE	T1,ARG.HD(S1),AR.TYP	;SAVE THE TYPE IN BLOCK
	PJRST	MOVARG			;MOVE THE BLOCK AND RETURN

	SUBTTL	PVOLID	--	PROCESS VOLUME ID BLOCK

	;THIS ROUTINE WILL BUILD A VOLUME ID BLOCK

PVOLID:	PUSHJ	P,P$QSTR		;CHECK FOR QUOTED STRING
	JUMPT	PVOL.1			;YES..PROCESS IT
	PUSHJ	P,P$FLD			;CHECK FOR FIELD
	JUMPF	.POPJ			;ERROR..RETURN
PVOL.1:	MOVX	T1,.VOLID		;VOLUME ID
	STORE	T1,ARG.HD(S1),AR.TYP	;SAVE THE TYPE
	PJRST	MOVARG			;MOVE THE BLOCK AND RETURN
	SUBTTL	SETINI	--	SET INITIALIZE COMMAND FOR TAPES

	;THIS COMMAND WILL BUILD A MESSAGE FOR THE TAPE PROCESSOR
	;CONTAINING THE NECESSAY INFO FOR INITIALIZING TAPES

SETINI:	CAIE	S1,.KYINI		;WAS IT INITIALIZE
	$RETF				;NO..RETURN FALSE
	MOVEI	S1,.DVINI		;DEVICE INITIALIZE
	MOVEI	S2,1			;GET THE TYPE
	PUSHJ	P,ARGRTN		;SAVE THE ARGUMENT
SETI.1:	PUSHJ	P,P$SWIT		;GET A SWITCH
	JUMPF	CMDEND			;END THE COMMAND
	MOVEI	S2,SETIDP		;ADDRESS OF THE TABLE
	PUSHJ	P,TABSRC		;SEARCH THE TABLE
	JUMPF	.POPJ			;PASS ERROR UP
SETI.3:	HLRZ	P1,(S2)			;GET BLOCK TYPE
	HRRZ	S2,(S2)			;GET ROUTINE ADDRESS
	JRST	(S2)			;PROCESS ROUTINE

SETIDP:	$STAB
	.SWDEN,,[.SIDEN,,SETDEN]	;/DENSITY
	.SWLBT,,[.SILBT,,SETLBT]	;/LABEL-TYPE
	.SWOVR,,[.SIOVR,,SETOVR]	;/OVERIDE-EXPIRATION
	.SWOWN,,[.SIOWN,,SETOWN]	;/OWNER
	.SWPRO,,[.SIPRO,,SETPRO]	;/PROTECTION
	.SWTDP,,[0,,SETTDP]		;/TAPE-DISPOSITION
	.SWCNT,,[.SICNT,,SETCNT]	;/COUNT
	.SWINC,,[.SIINC,,SETINC]	;/SET INCREMENT
	.SWSVI,,[.SISVI,,SETSVI]	;/STARTING-VOLUME-ID
	.SWVID,,[.VOLID,,SETVID]	;/VOLUME-ID
	$ETAB
	SUBTTL	SETDEN	--	SET TAPE INIT DENSITY



SETDEN:	PUSHJ	P,P$KEYW		;GET A KEYWORD
	JUMPF	.POPJ			;BAD COMMAND
	MOVEI	S2,DENTAB		;DENSITY TABLE
SETD.1:	PUSHJ	P,TABSRC		;SEARCH THE TABLE
	JUMPF	.POPJ			;NO MATCH..ELSE VALUE IN S2
	MOVEM	S2,ARG.DA(P3)		;SAVE THE DATA
SETD.2:	MOVE	S1,P1			;GET ARGUMENT TYPE
	MOVX	S2,ARG.SZ		;GET THE SIZE
	PUSHJ	P,ARGRTN		;SAVE THE ARGUMENT
	JRST	SETI.1			;GET NEXT FIELD

DENTAB:	$STAB
	.KY160,,S.1600			;1600
	.KY625,,S.6250			;6250
	.KY800,,S.800			;800
	.KY556,,S.556			;556
	.KY200,,S.200			;200
	$ETAB


	SUBTTL	SETLBT	--	SET THE LABEL TYPE

SETLBT:	PUSHJ	P,P$KEYW		;GET A KEYWORD
	JUMPF	.POPJ			;BAD COMMAND
	MOVEI	S2,LBTTAB		;LABEL TYPE TABLE
	JRST	SETD.1			;PROCESS ARGUMENT

LBTTAB:	$STAB
	.KYANS,,S.ANSI			;ANSI LABELS
	.KYEBC,,S.EBCD			;EBCDIC 
	.KYT20,,S.T20			;TOPS-20 LABELS
	.KYUNL,,S.UNLA			;UNLABELED TAPE
	$ETAB


	SUBTTL	SETOVR	--	SET TAPE INIT OVERIDE FUNCTION


SETOVR:	PUSHJ	P,P$KEYW		;GET A KEYWORD
	JUMPF	.POPJ			;BAD COMMAND
	MOVEI	S2,OVRDSP		;OVERIDE TABLE
SETOV1:	PUSHJ	P,TABSRC		;SEARCH THE TABLE
	JUMPF	.POPJ			;PASS ERROR UP
	MOVE	S1,S2			;FUNCTION CODE
	MOVEI	S2,1			;ARGUMENT TYPE
	PUSHJ	P,ARGRTN		;SAVE THE ARGUMENT
	JRST	SETI.1			;GET THE NEXT ONE

OVRDSP:	$STAB
	.KYYES,,.SIOVR			;OVERIDE EXPIRATION
	.KYNO,,.SINOV			;NO OVERIDE
	$ETAB
	SUBTTL	SETOWN	--	SET TAPE INIT OWNER

SETOWN:	PUSHJ	P,P$USER		;GET THE USER FIELD
	JUMPF	.POPJ			;ERROR..RETURN
	MOVEM	S1,ARG.DA(P3)		;SAVE THE USER
	JRST	SETD.2			;FINISH BLOCK AND CONTINUE


	SUBTTL	SETPRO	--	SET THE PROTECTION FOR THE TAPE
	SUBTTL	SETCNT	--	SET THE COUNT MULTIPLE INITIALIZATION
	SUBTTL	SETINC	--	SET INCREMENT FOR NEXT VOLUME-ID
	SUBTTL	SETSVI	--	SET STARTING VOLUME NUMBER
SETCNT:
SETINC:
SETSVI:
SETPRO:	PUSHJ	P,P$NUM			;GET THE NUMBER
	JUMPF	.POPJ			;ERROR..RETURN
	MOVEM	S1,ARG.DA(P3)		;SAVE THE DATA
	JRST	SETD.2			;FINISH BLOCK AND RETURN


	SUBTTL	SETTDP	--	SET THE TAPE DISPOSITION WHEN DONE

SETTDP:	PUSHJ	P,P$KEYW		;GET A KEYWORD
	JUMPF	.POPJ			;BAD COMMAND
	MOVEI	S2,TDPDSP		;TAPE DISPOSITION TABLE
	JRST	SETOV1			;FINISH IT OFF

TDPDSP:	$STAB
	.KYHLD,,.SIHLD			;HOLD TAPE
	.KYUNL,,.SIUNL			;UNLOAD THE TAPE
	$ETAB
	SUBTTL	SETVID	--	SETUP VOLUME ID


SETVID:	PUSHJ	P,PVOLID		;PROCESS VOLUME-ID
	JUMPT	SETI.1			;O.K.. GET NEXT BLOCK
	POPJ	P,			;PASS ERROR UP
	
	SUBTTL	TABSRC	--	TABLE SEARCH ROUTINE

	;THIS ROUTINE WILL SEARCH A TABLE FOR A SPECIFIED VALUE AND
	;RETURN THE ASSOCIATED INFO
	;THE TABLE ENTRIES SHOULD HAVE CODE IN LEFT HALF AND DATA IN RIGHT HALF
	;AND USE $STAB TO START THE TABLE AND $ETAB TO END IT


	;CALL	S1/	ITEM TO LOOK FOR 
	;	S2/	ADDRESS OF TABLE
	;
	;
	;RETURN	S1/	ITEM TO LOOK FOR
	;	S2/	ITEM FOUND IN TABLE


	;WILL USE T1 AND T2 FOR SCRATCH

TABSRC:: HLLZ	T1,(S2)			;GET THE NUMBER OF ENTRIES
	MOVN	T1,T1			;MAKE IT NEGATIVE
	HRRI	T1,1(S2)		;ADDRESS OF THE TABLE
TABS.1:	HLRZ	T2,(T1)			;GET THE ENTRY
	CAMN	S1,T2			;MATCH?
	JRST	TABS.2			;YES..
	AOBJN	T1,TABS.1		;TRY NEXT ONE
	$RETF				;ERROR..RETURN
TABS.2:	HRRZ	S2,(T1)			;GET THE DATA
	$RETT				;RETURN TRUE
	SUBTTL	GETDES	--	GET DEVICE DESIGNATOR WORD

	;THIS ROUTINE WILL RETURN THE DEVICE DESIGNATOR WORD FOR
	;THE DEVICE BLOCK PASSED
	;
	;RETURN	S2/	DEVICE DESIGNATOR INFO

IFN	FTJSYS,<
GETDES:	HRROI	S1,ARG.DA(S1)		;GET STRING ADDRESS
	HRRZM	S1,G$ARG1		;SAVE THE POINTER
	STDEV				;GET DESIGNATOR
	  $RETF				;RETURN FALSE
	TRNE	S2,400000		;CHECK NOT MT DEVICE
	  PJRST	E$ITD			;ERROR CODE
	HLRZS	S2			;CLEAR RIGHT HALF AND PLACE IN RIGHT
	SUBI	S2,.DVDES		;GET TO DEVICE TYPE
	$RETT				;RETURN DESIGNATOR IN S2
>;END FTJSYS

IFN	FTUUOS,<
GETDES:	HRROI	S1,ARG.DA(S1)		;GET STRING ADDRESS
	HRRZM	S1,G$ARG1		;SAVE STRING POINTER
	PUSHJ	P,S%SIXB		;CONVERT TO SIXBIT
	DEVCHR	S2,			;DO THE DEVCHR
	SKIPN	S2			;ANY BITS
	$RETF				;RETURN FALSE
	$RETT				;RETURN TRUE
>;END FTUUOS
	SUBTTL	GETTAP	--	GET A TAPE DEVICE

	;THIS ROUTINE WILL CHECK FOR A VALID TAPE DEVICE AND RETURN FALSE
	;IF DEVICE IS NOT THERE
	;OTHERWISE
	;	S1/	ADDRESS OF BLOCK
	;	S2/	LENGTH OF BLOCK

IFN	FTJSYS,<
GETTAP:	DMOVE	T1,S1			;SAVE THE ARGUMENTS
	PUSHJ	P,GETDES		;GET THE DESIGNATOR
	JUMPF	E$ITD			;ERROR ..RETURN
	CAIE	S2,.DVMTA		;IS IT MTA
	JRST	GETT.1			;SETUP ERROR RETURN
	DMOVE	S1,T1			;RESTORE S1 AND S2 FROM P$DEV RETURN
	$RETT				;RETURN TRUE
GETT.1:	DMOVE	S1,T1			;RESTORE DEVICE DATA
	$RETF				;RETURN FALSE
>;END FTJSYS

IFN	FTUUOS,<
GETTAP:	DMOVE	T1,S1			;SAVE AC'S IN T1 AND T2
	PUSHJ	P,GETDES		;GET DEVICE DESIGNATOR
	JUMPF	.POPJ			;ERROR RETURN
	TXNN	S2,DV.MTA		;TAPE DRIVE
	PJRST	E$ITD			;INVALID TAPE DRIVE
	DMOVE	S1,T1			;RESTORE S1 AND S2
	$RETT				;RETURN TRUE
>;END FTUUOS
	SUBTTL	SETSTR	--	SET STRUCTURE COMMAND FOR -20

IFN	FTJSYS,<
SETSTR:	PUSHJ	P,CHKWHL		;PROGRAM WHEEL OR OPERATOR
	JUMPF	E$IPE			;INSUFFIECIENT PRIVILEGES
	MOVX	S1,.OTSST		;SET STRUCTURE COMMAND FOR -20
	STORE	S1,.MSTYP(MO),MS.TYP	;SAVE THE TYPE IN HEADER
	PUSHJ	P,PSTRUC		;PROCESS A STRUCTURE BLOCK
	JUMPF	.POPJ			;ERROR..RETURN
	PUSHJ	P,P$KEYW		;GET THE OPTIONS
	JUMPF	.POPJ			;ERROR..RETURN
	MOVEI	S2,STRDSP		;STRUCTURE DISPATCH TABLE
	PUSHJ	P,TABSRC		;SEARCH THE TABLE
	JUMPF	.POPJ			;ERROR..RETURN
	MOVEM	S2,ARG.DA(P3)		;SAVE VALUE IN BLOCK
	MOVX	S1,.STCHR		;STRUCTURE CHARACTERISTICS
	MOVEI	S2,2			;SIZE OF BLOCK
	PUSHJ	P,ARGRTN		;BUILD BLOCK
	PJRST	CMDEND			;CHECK FOR END AND SEND TO QUASAR

STRDSP:	$STAB
	.KYACK,,S.ACKN			;ACKNOWLEDGED
	.KYAVA,,S.AVAL			;AVAILABLE
	.KYDOM,,S.DOMS			;DOMESTIC
	.KYFOR,,S.FORN			;FOREIGN
	.KYREG,,S.REGU			;REGULATED
	.KYUAV,,S.UAVL			;UNAVAILABLE
	.KYURG,,S.UREG			;UNREGULATED
	.KYIGN,,S.IGNO			;IGNORE
	$ETAB
>;END FTJSYS
	SUBTTL	Q$SHWS	--	SHOW STATUS ROUTINE

;THIS ROUTINE WILL SEND A SHOW STATUS MESSAGE  TO QUASAR

Q$SHWS:: MOVX	S1,.OMSHS		;GET THE SHOW STATUS CODE
	STORE	S1,.MSTYP(MO),MS.TYP	;SAVE THE TYPE CODE
	PJRST	PROSHW			;PROCESS SHOW MESSAGE


	SUBTTL	Q$SHWP	--	SHOW PARAMETERS ROUTINE

;THIS ROUTINE WILL SEND A SHOW PARAMETERS MESSAGE TO QUASAR

Q$SHWP:: MOVX	S1,.OMSHP		;GET SHOW PARAMTERS CODE
	STORE	S1,.MSTYP(MO),MS.TYP	;SAVE THE TYPE CODE
	PJRST	PROSHW			;PROCESS SHOW MESSAGE
	SUBTTL	PROSHW	--	PROCESS SHOW STATUS AND SHOW PARAMETERS


	;COMMON CODE FOR SHOW STATUS AND SHOW PARAMETERS

PROSHW:	SETOM	ARG.DA+OBJ.TY(P3)	;DEFAULT TO ALL TYPES
	SETOM	ARG.DA+OBJ.UN(P3)	;DEFAULT FOR ALL UNITS
	SETOM	ARG.DA+OBJ.ND(P3)	;DEFAULT FOR ALL NODES
	MOVE	S1,G$OPRA		;GET THE OPERATOR ADDRESS
	MOVX	T1,OP.REM		;REMOTE OPERATOR FLAG
	TDNN	T1,OPR.FL(S1)		;IS IT REMOTE?
	JRST	PROS.0			;NO.. ASSUME ALL NODES AS DEFAULT
	MOVE	S2,OPR.ND(S1)		;GET NODE ADDRESS
	MOVE	S2,NOD.NX(S2)		;GET THE NODE NAME
	MOVEM	S2,ARG.DA+OBJ.ND(P3)	;SAVE THE NODE IN BLOCK
PROS.0:	PUSHJ	P,P$CFM			;CHECK FOR CONFIRM
	JUMPT	PROS.6			;SAVE BLOCK AND RETURN
	PUSHJ	P,P$KEYW		;GET A KEYWORD..(TYPE)
	JUMPF	PROS.2			;TRY FOR A SWITCH
	CAIG	S1,.OTMAX		;VALID OBJECT TYPE
	JRST	PROS.1			;YES..GOOD OBJECT
	CAIN	S1,.KYDSK		;WAS IT A DISK?
	PJRST	SHWDSK			;PROCESS THE DISKS
	CAIN	S1,.KYSTR		;WAS IT A STRUCTURE
	PJRST	SHWSTR			;PROCESS THE STRUCTURES
	CAIN	S1,.KYATP		;ALL TAPES?
	PJRST	SHWTAP			;PROCESS THE TAPES
	CAIN	S1,.KYNOD		;CHECK FOR NETWORK NODE
	PJRST	SHWNOD			;SHOW NODE COMMAND
	$RETF				;BAD COMMAND

PROS.1:	MOVEM	S1,ARG.DA+OBJ.TY(P3)	;SAVE THE OBJECT TYPE
	PUSHJ	P,P$CFM			;END OF COMMAND?
	JUMPT	PROS.5			;FINISH OFF BLOCK
PROS.2:	PUSHJ	P,P$SWIT		;CHECK FOR A SWITCH
	JUMPF	PROS.4			;NO..TRY OBJECT BLOCK REMAINDER
	CAIE	S1,.SWNOD		;NODE?
	 JRST	[PUSHJ	P,PROSHT		;PROCESS SHORT IF THERE
		JUMPF	.POPJ		;ERROR..RETURN
		PJRST	PROS.5]		;FINISH OFF THE BLOCK
	PUSHJ	P,P$NODE		;GET THE NODE
	JUMPF	.POPJ			;ERROR..RETURN
PROS.3:	MOVEM	S1,ARG.DA+OBJ.ND(P3)	;SAVE NODE IN BLOCK
	PUSHJ	P,OPRENB		;CHECK IF OPR ENABLED FOR NODE
	JUMPF	.POPJ			;ERROR ..RETURN
	PUSHJ	P,P$SWIT		;CHECK FOR A SWITCH
	JUMPF	PROS.5			;NO..JUST SAVE OBJECT BLOCK
	CAIE	S1,.SWSHT		;WAS IT SHORT
	$RETF				;NO..RETURN FALSE
	MOVX	S1,LS.FST		;GET THE FLAGS
	IORM	S1,.OFLAG(MO)		;SAVE IN FLAG WORD
	JRST	PROS.5			;SAVE THE BLOCK AND FINISH
PROS.4:	PUSHJ	P,FINOBJ		;FINISH OBJECT BLOCK
	JUMPF	.POPJ			;NO..ERROR..RETURN
	PUSHJ	P,P$SWIT		;SWITCH THERE?
	JUMPF	CMDEND			;CHECK FOR THE END
	PUSHJ	P,PROSHT		;PROCESS /SHORT IF THERE
	JUMPF	.POPJ			;ERROR...RETURN
	PJRST	CMDEND			;CHECK FOR END AND SEND IT
PROS.5:	MOVX	S1,.OROBJ		;BLOCK TYPE
	MOVX	S2,.OBJLN		;BLOCK SIZE
	PUSHJ	P,ARGRTN		;SAVE THE BLOCK
	ANDI	P3,777			;GET LENGTH OF MESSAGE
	STORE	P3,.MSTYP(MO),MS.CNT	;SAVE THE COUNT
	PJRST	SNDQSR			;SEND THE COMMAND
PROS.6:	PUSHJ	P,CHKWHL		;WHEEL OR OPERATOR?
	JUMPT	PROS.5			;YES..SAVE BLOCK NOW
	MOVE	S1,G$OPRA		;GET OPERATOR ADDRESS
	MOVE	S1,OPR.ND(S1)		;GET NODE ADDRESS
	MOVE	S1,NOD.NX(S1)		;GET NODE NAME
	MOVEM	S1,ARG.DA+OBJ.ND(P3)	;SAVE VALUE
	PJRST	PROS.5			;FINISH OFF COMMAND

PROSHT:	CAIE	S1,.SWSHT		;WAS IT SHORT
	$RETF				;NO..RETURN FALSE
	MOVX	S1,LS.FST		;GET THE FLAGS
	IORM	S1,.OFLAG(MO)		;SAVE IN FLAG WORD
	$RETT				;RETURN TRUE

Q$SHWR:: MOVX	S1,.OMSHR		;SHOW ROUTE TABLES
	STORE	S1,.MSTYP(MO),MS.TYP	;SAVE THE MESSAGE TYPE
	MOVEI	S1,.OHDRS		;JUST THE HEADER
	STORE	S1,.MSTYP(MO),MS.CNT	;SAVE THE COUNT
	PJRST	SNDQSR			;SEND TO QUASAR
	SUBTTL	SHWNOD	--	SHOW STATUS/PARAMETERS NETWORK COMMAND

	;THIS ROUTINE WILL BUILD A NODE BLOCK FOR QUASAR TO IDENTIFY THE
	;NODE TO BE EXAMINED.
	;IF NO NODENAME IS SPECIFIED THE DEFAULT -1 WILL BE USED.

SHWNOD:	MOVX	S1,.OMSSN		;SHOW STATUS NODE
	LOAD	S2,.MSTYP(MO),MS.TYP	;GET THE TYPE BLOCK
	CAIE	S2,.OMSHS		;WAS IT SHOW STATUS
	MOVX	S1,.OMSPN		;NO..SHOW PARAMETERS NODE
	STORE	S1,.MSTYP(MO),MS.TYP	;SAVE THE TYPE IN BLOCK
	PUSHJ	P,P$NODE		;GET THE NODE DATA
	SKIPT				;O.K.. CONTINUE ON
	SETOM	S1			;ASSUME ALL NODES
	PUSHJ	P,SAVNOD		;SAVE THE VALUE
	PJRST	CMDEND			;END THE COMMAND AND SEND IT
	SUBTTL	SHWTAP	--	SHOW TAPE STATUS

	;THIS ROUTINE WILL SHOW THE STATUS OF THE TAPE DRIVE

SHWTAP:	PUSHJ	P,CHKWHL		;BETTER BE PRIVILEGED
	JUMPF	E$IPE			;INSUFFICIENT PRIVILEGES
	MOVEI	S1,.OTSHT		;SHOW STATUS COMMAND
	STORE	S1,.MSTYP(MO),MS.TYP	;SAVE THE MESSAGE TYPE
	PUSHJ	P,P$DEV			;WAS IT A DEVICE
	JUMPT	SHWT.1			;YES.. BUILD DEVICE BLOCK
	MOVX	S1,.ALTAP
	MOVEI	S2,1			;BLOCK SIZE
	PUSHJ	P,ARGRTN		;SAVE THE BLOCK
	JRST	SHWT.2			;FINISH OFF THE COMMAND
SHWT.1:	PUSHJ	P,PSTA.1		;BUILD THE BLOCK
	JUMPF	.POPJ			;FAIL..RETURN
SHWT.2:	PUSHJ	P,P$SWIT		;IS THERE A SWITCH?
	JUMPF	CMDEND			;NO..FINISH OFF COMMAND
	MOVEI	S2,TAPSWI		;TAPE SWITCHES
SHWTAB:	PUSHJ	P,TABSRC		;SEARCH THE TABLE
	JUMPF	.POPJ			;ERROR..RETURN
	MOVE	S2,(S2)			;GET THE DATA
	IORM	S2,.OFLAG(MO)		;SAVE THE FLAGS
	PJRST	CMDEND			;END THE COMMAND

TAPSWI:	$STAB
	.SWALL,,[ST.ALL]		;ALL
	.SWCHR,,[ST.CHR]		;CHARACTERISTICS
	.SWFRE,,[ST.AVA]		;FREE(AVAILABLE)
	$ETAB
	SUBTTL	SHWSTR	--	SHOW STATUS STRUCTURES

	;THIS COMMAND WILL SHOW STATUS OF STRUCTURES 

SHWSTR:	PUSHJ	P,CHKWHL		;MUST BE PRIVILEGED
	JUMPF	E$IPE			;INSUFFICIENT PRIVILEGES
	MOVEI	S1,.OMSTR		;GET MESSAGE TYPE
	STORE	S1,.MSTYP(MO),MS.TYP	;SAVE THE TYPE
	PUSHJ	P,PSTRUC		;PROCESS THE STRUCTURE
	PJRST	CMDEND			;END THE COMMAND AND SEND TO QUASAR
	SUBTTL	SHWDSK	--	SHOW STATUS DISK DRIVES

	;THIS ROUTINE WILL DO SHOW STATUS OF DISK DRIVES

SHWDSK:	PUSHJ	P,CHKWHL		;BETTER BE PRIVILEGED
	JUMPF	E$IPE			;INSUFFICIENT PRIVILEGES
	MOVEI	S1,.OTSHD		;SHOW STATUS COMMAND
	STORE	S1,.MSTYP(MO),MS.TYP	;SAVE THE MESSAGE TYPE
	MOVX	S1,.ALDSK		;FOR ALL DISK DRIVES
	MOVEI	S2,1			;ONE WORD
	PUSHJ	P,ARGRTN		;SAVE THE BLOCK
	PUSHJ	P,P$SWIT		;CHECK FOR A SWITCH
	JUMPF	CMDEND			;NONE.. FINISH OFF COMMAND
	MOVEI	S2,DSKDSP		;GET DSK TABLE ADDRESS
	JRST	SHWTAB			;DO THE TABLE LOOKUP


DSKDSP:	$STAB
	.SWALL,,[ST.ALL]		;ALL
	.SWAVA,,[ST.AVA]		;AVAILABLE
	.SWMNT,,[ST.MNT]		;MOUNTED
	$ETAB
	SUBTTL	Q$SHWQ	--	SHOW QUEUES COMMAND

	;THIS ROUTINE WILL FORMAT MESSAGE TO QUASAR FOR SHOW QUEUES

Q$SHWQ:: MOVX	S1,.OMSHQ		;SHOW THE QUEUES
	STORE	S1,.MSTYP(MO),MS.TYP	;SAVE THE MESSAGE TYPE
	PUSHJ	P,P$KEYW		;GET A KEYWORD
	JUMPF	SHWQ.7			;CHECK FOR CONFIRM
	MOVEI	S2,QUETYP		;GET THE QUEUE TYPE
	PUSHJ	P,TABSRC		;SEARCH THE TABLE
	JUMPT	SHWQ.2			;PROCESS QUEUE TYPE
	CAIN	S1,.KYALL		;WAS ALL WANTED
	JRST	[ SETO	S1,		;SET FOR ALL QUEUES
		JRST	SHWQ.3	]	;SAVE THE ENTRY
	PJRST	E$IQS			;INVALID QUEUE SPECIFIED
SHWQ.2:	MOVE	S1,(S2)			;GET THE DATA
SHWQ.3:	STORE	S1,.OHDRS+ARG.DA(MO)	;SAVE IN MESSAGE
	MOVEI	S1,.LSQUE		;GET ARGUMENT TYPE
	MOVEI	S2,ARG.SZ		;GET ARGUMENT SIZE
	PUSHJ	P,ARGRTN		;SETUP THE ARGUMENT
	PUSHJ	P,P$CFM			;CHECK FOR COMMAND END
	JUMPF	SHWQ.5			;CHECK FOR SWITCHES
	PUSHJ	P,CHKRMT		;CHECK FOR NODE BLOCK NEEDED
SHWQ.4:	ANDI	P3,777			;GET MESSAGE LENGTH
	STORE	P3,.MSTYP(MO),MS.CNT	;SAVE THE COUNT
	PJRST	SNDQSR			;SEND THE MESSAGE TO QUASAR
SHWQ.5:	PUSHJ	P,P$SWIT		;CHECK FOR SWITCHES
	JUMPF	.POPJ			;BAD COMMAND ..RETURN FALSE
	SETZM	T1			;SET A FLAG
	CAIN	S1,.SWNOD		;WAS IT A NODE?
	JRST	SHWQ.9			;YES..CHECK IT OUT
	CAIN	S1,.SWALL		;WAS IT ALL
	MOVX	T1,LS.ALL		;SETUP ALL FLAG
	CAIN	S1,.SWSHT		;WAS IT SHORT
	MOVX	T1,LS.FST		;SETUP FAST LISTING
	JUMPE	T1,.RETF		;NONE SET..RETURN FALSE
	MOVEM	T1,.OFLAG(MO)		;SAVE FLAGS IN MESSAGE
	PUSHJ	P,P$SWIT		;IS THERE A SWITCH LEFT?
	JUMPT	SHWQ.8			;CHECK IF NODE AND VALIDATE
	PUSHJ	P,CHKRMT		;CHECK IF REMOTE
SHWQ.6:	PUSHJ	P,P$CFM			;CHECK FOR MESSAGE END
	JUMPT	SHWQ.4			;FINISH AND SEND MESSAGE
	$RETF				;RETURN FALSE
SHWQ.7:	SETO	S1,			;SETUP FOR ALL QUEUES
	PJRST	SHWQ.3			;SETUP BLOCK AND RETURN
SHWQ.8:	CAIE	S1,.SWNOD		;WAS IT A NODE
	$RETF				;NO..RETURN FALSE
SHWQ.9:	PUSHJ	P,CNODSW		;CHECK OUT THE NODE
	JUMPF	.POPJ			;FAIL..RETURN
	JRST	SHWQ.6			;CHECK FOR THE END

	DEFINE	X(TYP),<
	.OT'TYP,,[LIQ'TYP] >
QUETYP:	$STAB
	DEVQUE
	$ETAB
	SUBTTL	Q$SHWC	--	SHOW CONTROL FILE COMMAND

	;THIS ROUTINE DOES THE OLD BATCON EXAMINE FUNCTION FOR
	;SHOWING THE OPERATOR LINES IN A BATCH CONTROL-FILE

Q$SHWC:: MOVX	S1,.OMSHC		;SHOW CONTROL-FILE TYPE
	STORE	S1,.MSTYP(MO),MS.TYP	;SAVE THE TYPE
	PUSHJ	P,BLDOBJ		;BUILD AN OBJECT BLOCK
	JUMPF	.POPJ			;ERROR..RETURN
	MOVEI	T1,.OHDRS+ARG.DA(MO)	;POINT TO OBJECT BLOCK
	LOAD	S1,OBJ.UN(T1),OU.HRG	;GET THE HIGH VALUE
	JUMPN	S1,.RETF		;NON-ZERO..ERROR
	LOAD	S1,OBJ.TY(T1)		;GET THE TYPE FIELD
	CAXE	S1,.OTBAT		;BETTER BE BATCH
	$RETF				;RETURN FALSE..ERROR
	PUSHJ	P,P$SWIT		;GET A SWITCH
	JUMPF	SHWC.2			;NO..SETUP DEFAULT LINES
	CAIE	S1,.SWLNS		;IS IT LINES
	$RETF				;INVALID COMMAND
	MOVEI	T2,.SHCLN		;YES..SETUP SHOW LINES TYPE
	PUSHJ	P,P$NUM			;GET A NUMBER
	JUMPF	.POPJ			;ERROR..RETURN
SHWC.1:	STORE	S1,ARG.DA(P3)		;SAVE NUMBER IN BLOCK
	MOVE	S1,T2			;GET THE ARGUMENT TYPE
	MOVEI	S2,ARG.SZ		;SIZE OF THE BLOCK
	PUSHJ	P,ARGRTN		;SAVE THE ARGUMENT
	PJRST	CMDEND			;FINISH OFF THE MESSAGE
SHWC.2:	MOVEI	S1,^D10			;DEFAULT TO 10 LINES
	MOVEI	T2,.SHCLN		;SHOW CONTROL FILE LINES
	JRST	SHWC.1			;FINISH OFF BLOCK AND MESSAGE
	SUBTTL	Q$DISMOUNT	--	DISMOUNT COMMAND FOR THE -20

Q$DISMOUNT::
	PUSHJ	P,CHKWHL		;PROGRAM WHEEL OR OPERATOR
	JUMPF	E$IPE			;INSUFFIECIENT PRIVILEGES
	PUSHJ	P,P$KEYW		;GET THE KEYWORD
	JUMPF	.POPJ			;ERROR..RETURN
	CAIE	S1,.KYSTR		;IS IT A STRUCTURE
	JRST	DISM.1			;NO..TRY TAPE
	PUSHJ	P,PSTRUC		;PROCESS THE STRUCTURE
	JUMPT	CMDEND			;O.K... FINISH OFF COMMAND
	POPJ	P,			;PASS THE ERROR BACK
DISM.1:	CAIE	S1,.KYTAP		;CHECK FOR A TAPE
	$RETF				;NO..RETURN FALSE
	MOVEI	S1,.OTUNL		;GET THE UNLOAD TYPE
	STORE	S1,.MSTYP(MO),MS.TYP	;RESET THE MESSAGE TYPE
	JRST	UNLO.1			;PROCESS THE UNLOAD


	SUBTTL	Q$RECOGNIZE	--	RECOGNIZE COMMAND FOR THE -10
	SUBTTL	Q$UNLOAD	--	UNLOAD COMMAND FOR TAPES

IFN	FTUUOS,<
Q$RECOGNIZE::
>;END	FTUUOS
Q$UNLOAD::
	PUSHJ	P,CHKWHL		;PROGRAM WHEEL OR OPERATOR
	JUMPF	E$IPE			;INSUFFIECIENT PRIVILEGES
UNLO.1:	PUSHJ	P,PSTAPE		;SAVE THE TAPE BLOCK
	JUMPT	CMDEND			;O.K... FINISH OFF COMMAND
	POPJ	P,			;PASS THE ERROR BACK
	SUBTTL	Q$ESTR	--	ENABLE AUTOMATIC STRUCTURE RECOGNITION

Q$ESTR:: PUSHJ	P,CHKWHL		;PROGRAM WHEEL OR OPERATOR
	JUMPF	E$IPE			;INSUFFIECIENT PRIVILEGES
	MOVX	S1,.OTENA		;GET ENABLE CODE
	SKIPE	P1			;CHECK IF ENABLE OR DISABLE
	MOVX	S1,.OTDIS		;GET DISABLE CODE
	STORE	S1,.MSTYP(MO),MS.TYP	;SAVE THE TYPE IN MESSAGE
	MOVX	S1,.ASREC		;GET ASR TYPE
	MOVEI	S2,1			;GET THE LENGTH
	PUSHJ	P,ARGRTN		;ADD ARGUMENT TO MESSAGE
	PUSHJ	P,P$KEYW			;GET A KEYWORD
	JUMPF	CMDEND			;NO...CHECK END AND SEND
	CAIN	S1,.KYSTR		;WAS IT FOR ALL STRUCTURES
	JRST	ESTR.1			;YES SETUP FOR ALL STRUCTURES
	PUSHJ	P,PSTRUC		;PROCESS A STRUCTURE BLOCK
	JUMPT	CMDEND			;O.K.. FINISH AND SEND
	POPJ	P,			;ELSE RETURN WITH CURRENT FALSE STATE
ESTR.1:	MOVX	S1,.ALSTR		;ALL STRUCTURES
	MOVEI	S2,1			;LENGTH OF BLOCK
	PUSHJ	P,ARGRTN		;BUILD THE ARGUMENT
	PJRST	CMDEND			;FINISH OFF COMMAND
	SUBTTL	Q$ETAPE	--	ENABLE TAPE COMMAND
	SUBTTL	Q$DTAPE	--	DISABLE TAPE COMMAND

	;THIS ROUTINE WILL HANDLE ENABLE AND DISABLE TAPE COMMANDS

Q$DTAPE::
Q$ETAPE:: PUSHJ	P,CHKWHL		;PROGRAM WHEEL OR OPERATOR
	JUMPF	E$IPE			;INSUFFIECIENT PRIVILEGES
	MOVX	S1,.OTENA		;GET ENABLE CODE
	SKIPE	P1			;CHECK IF ENABLE OR DISABLE
	MOVX	S1,.OTDIS		;GET DISABLE CODE
	STORE	S1,.MSTYP(MO),MS.TYP	;SAVE THE TYPE IN MESSAGE
	MOVX	S1,.AVREC		;GET AVR TYPE
	MOVEI	S2,1			;GET THE LENGTH
	PUSHJ	P,ARGRTN		;ADD ARGUMENT TO MESSAGE
	PUSHJ	P,P$KEYW			;GET A KEYWORD
	JUMPF	CMDEND			;NO...CHECK END AND SEND
	CAIN	S1,.KYATP		;WAS IT FOR ALL TAPES
	JRST	ETAP.1			;YES SETUP FOR ALL TAPES
	PUSHJ	P,PSTAPE		;PROCESS A TAPE BLOCK
	JUMPF	.POPJ			;ERROR..RETURN
	PJRST	CMDEND			;FINISH COMMAND AND SEND TO QUASAR
ETAP.1:	MOVX	S1,.ALTAP		;ALL TAPES
	MOVEI	S2,1			;LENGTH OF BLOCK
	PUSHJ	P,ARGRTN		;BUILD THE ARGUMENT
	PJRST	CMDEND			;FINISH OFF COMMAND
	SUBTTL	Q$LOCK/Q$ULOCK		;LOCK AND UNLOCK COMMAND

	;THIS COMMAND WILL LOCK A STRUCTURE FROM FURTHER ACCESS
	;NOW OR OPTIONALLY AT A SPECIFIED TIME


Q$LOCK:: SETOM	P1			;SET FOR LOCK
	SKIPA				;SKIP UNLOCK
Q$ULOCK:: SETZM P1			;SET FOR UNLOCK 
	PUSHJ	P,PSTRUC		;GET THE STRUCTURE
	JUMPF	.POPJ			;INVALID COMMAND
	PUSHJ	P,P$TIME		;GET THE TIME
	MOVEM	S1,ARG.DA(P3)		;SAVE THE UDT
	MOVX	S1,.ORTIM		;TIME BLOCK
	MOVEI	S2,ARG.SZ		;GET THE SIZE
	PUSHJ	P,ARGRTN		;SAVE THE ARGUMENT
	PJRST	CMDEND			;END IT
	SUBTTL	Q$MOUNT	--	MOUNT TAPE AND DISK COMMAND


;	remove the mount command on Jul 9,1979
	comment \


	;THIS COMMAND WILL BUILD MESSAGE FOR MOUNTING STRUCTURES

Q$MOUNT:: PUSHJ	P,CHKWHL		;PROGRAM WHEEL OR OPERATOR
	JUMPF	E$IPE			;INSUFFICIENT PRIVILEGES
	PUSHJ	P,P$KEYW		;CHECK FOR A KEYWORD
	JUMPF	.POPJ			;NO..INVALID COMMAND
	CAIE	S1,.KYSTR		;IS IT A STRUCTURE
	$RETF				;NO..INVALID COMMAND
	PUSHJ	P,PSTRUC		;PROCESS THE STRUCTURE
	JUMPF	.POPJ			;ERROR..RETURN
	PUSHJ	P,P$DEV			;CHECK FOR ALIAS NAME
	JUMPF	CMDEND			;NO..CHECK FOR COMMAND END
	MOVX	T1,.STALS		;STRUCTURE ALIAS
	STORE	T1,ARG.HD(S1),AR.TYP	;SAVE CODE IN BLOCK
	PUSHJ	P,MOVARG		;MOVE THE BLOCK
	PJRST	CMDEND			;CHECK FOR END..AND SEND TO QUASAR


	\;end of mount command
	SUBTTL	Q$IDENTIFY	--	IDENTIFY COMMAND FOR TAPES

	;THIS COMMAND WILL IDENTIFY A  TAPE DRIVE WITH A PARTICULAR TAPE 
	;REQUEST  OR TAPE VOLUME

Q$IDENTIFY::
	PUSHJ	P,CHKWHL		;PROGRAM WHEEL OR OPERATOR
	JUMPF	E$IPE			;NO..INSUFFICIENT PRIVILEGES
	PUSHJ	P,PSTAPE		;SAVE THE TAPE BLOCK
	JUMPF	.POPJ			;ERROR..RETURN
	PUSHJ	P,P$KEYW		;CHECK FOR A KEYWORD
	JUMPF	.POPJ			;NO..ERROR..RETURN
	MOVEI	S2,IDNDSP		;USE THE DISPATCH
	PUSHJ	P,TABSRC		;CHECK THE TABLE
	JUMPF	.POPJ			;ERROR..RETURN
	PJRST	(S2)			;DO THE WORK

IDNDSP:	$STAB
	.KYRQN,,IDNRQN			;REQUEST NUMBER
	.KYSCR,,IDNSCR			;SCRATCH TAPE
	.KYVID,,IDNVID			;VOLUME-ID
	$ETAB

	; VOLUME-ID FOR IDENTIFY

IDNVID:	PUSHJ	P,PVOLID		;PROCESS VOLUME ID
	JUMPT	CMDEND			;O.K.. FINISH OFF MESSAGE
	POPJ	P,			;ERROR.. PASS CODE UP

	;  REQUEST NUMBER FOR IDENTIFY

IDNRQN:	PUSHJ	P,PREQNM			;PROCESS REQUEST NUMBER
	JUMPF	.POPJ			;ERROR..RETURN
	PJRST 	CMDEND			;FINISH OFF COMMAND


	;  SCRATCH FOR IDENTIFY

IDNSCR:	MOVEI	S1,.SCRTP		;SCRATCH TAPE
	MOVEI	S2,1			;ONE WORD BLOCK
	PUSHJ	P,ARGRTN		;SAVE THE ARGUMENT
	PJRST	CMDEND			;FINISH OFF THE COMMAND
	SUBTTL	Q$DEFINE	--	DEFINE COMMAND FOR D60

	;THIS COMMAND WILL DEFINE A DN60 NODE  SO THAT PARAMETERS CAN BE SET

IFN	FTDN60,<
Q$DEFINE::
	PUSHJ	P,CHKWHL		;PROGRAM WHEEL OR OPERATOR
	JUMPF	E$IPE			;INSUFFIECIENT PRIVILEGES
	PUSHJ	P,P$KEYW		;GET THE KEYWORD
	JUMPF	.POPJ			;ERROR..RETURN
	CAIE	S1,.KYNOD		;BETTER BE NODE
	$RETF				;NO..RETURN FALSE
	PUSHJ	P,P$NODE		;GET A NODE
	JUMPF	.POPJ			;ERROR RETURN
	PUSHJ	P,SAVNOD		;SAVE THE NODE
	PUSHJ	P,P$KEYW		;GET A KEYWORD
	JUMPF	.POPJ			;ERROR..RETURN
	SETZ	T1,			;SET A FLAG
	CAIN	S1,.KY278		;WAS IT 2780
	MOVX	T1,DF.278		;2780
	CAIN	S1,.KY378		;WAS IT 3780
	MOVX	T1,DF.378		;3780
	CAIN	S1,.KYHSP		;WAS IT HASP
	MOVX	T1,DF.HSP		;HASP
	JUMPE	T1,.RETF		;ERROR..RETURN FALSE
	MOVEM	T1,DEF.TY(P3)		;SAVE THE TYPE
	PUSHJ	P,P$KEYW		;GET  MODE KEYWORD
	JUMPF	.POPJ			;ERROR..RETURN
	SETZ	T1,			;SET THE FLAG
	CAIN	S1,.KYTRM		;WAS IT TERMINATION
	MOVX	T1,DF.TRM		;TERMINATION
	CAIN	S1,.KYEMU		;WAS IT EMULATION
	MOVX	T1,DF.EMU		;EMULATION
	JUMPE	T1,.RETF		;ZERO..ERROR..RETURN
	MOVEM	T1,DEF.MD(P3)		;SAVE THE MODE
	PUSHJ	P,P$NUM			;GET THE PORT NUMBER
	JUMPF	.POPJ			;ERROR..RETURN
	MOVEM	S1,DEF.PT(P3)		;SAVE THE PORT NUMBER
	PUSHJ	P,P$NUM			;GET THE LINE NUMBER
	JUMPF	.POPJ			;ERROR..RETURN
	MOVEM	S1,DEF.LN(P3)		;SAVE THE LINE NUMBER
	MOVX	S1,.DFBLK		;DEFINE BLOCK
	MOVEI	S2,DEF.SZ		;DEFINE SIZE
	PUSHJ	P,ARGRTN		;SAVE THE ARGUMENT
	PJRST	CMDEND			;FINISH COMMAND AND SEND IT
>;END FTDN60
	SUBTTL	Q$SWITCH	--	SWITCH COMMAND FOR THE -20

	;THIS COMMAND WILL SEND A MESSAGE TO MOUNTR (VIA QUASAR) TO
	;SWITCH A GIVEN REQUEST TO ANOTHER VOLUME/DRIVE.

IFN	FTJSYS,<
Q$SWITCH:: PUSHJ P,PREQNM		;PROCESS A REQUEST NUMBER
	JUMPF	.POPJ			;ERROR..RETURN
	PUSHJ	P,PVOLID		;PROCESS THE VOLUME ID
	JUMPF	.POPJ			;ERROR..RETURN
	PUSHJ	P,PSTAPE		;PROCESS A TAPE BLOCK
	PJRST	CMDEND			;TRY TO FINISH COMMAND IN ANY CASE
>;END FTJSYS
	END