Google
 

Trailing-Edge - PDP-10 Archives - tops20_v6_1_tcpip_distribution_tp_ft6 - galaxy-sources/oprlog.mac
There are 36 other files named oprlog.mac in the archive. Click here to see a list.
	TITLE	OPRLOG	ORION MODULE FOR BUILDING THE ORION LOG FILE
	SUBTTL	Preliminaries

;
;
;	COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION
;	1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985
;
;     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(OPRLOG)

	ERRSET				;INITIALIZE ERROR TABLES
	EXTERNAL G$ARG1			;ARGUMENT 1
	EXTERNAL G$ARG2			;ARGUMENT 2
	EXTERNAL G$ARG3			;ARGUMENT 3
	EXTERNAL G$JOB			;JOB NUMBER FROM IPCF MESSAGE
	EXTERNAL .JBVER			;VERSION LOCATION INFO

;Version numbers

	LOGMAN==:23			;Maintenance edit number
	LOGDEV==:32			;Development edit number
	VERSIN (LOG)			;Generate edit number

	COMMENT \

	THIS MODULE IS CALLED BY EACH MESSAGE WITHIN ORION FOR THE
	PURPOSE OF LOGGING THE INFORMATION IN THE ORION LOG FILE.
	IF THE ORION STARTUP FILE HAS TURNED OFF LOGGING THEN NO LOG
	FILE WILL BE CREATED AND THE ROUTINES WILL JUST RETURN

\


	EXTERNAL GOODMS			;GOOD MESSAGE COUNT
	EXTERNAL G$NOW			;TIME OF DAY FIELD
	EXTERNAL JOBTXT			;JOB TEXT HEADER
	EXTERNAL GETJBT			;GET JOB DATA
	EXTERNAL G$OPRA			;OPR ADDRESS
	EXTERNAL JOBTER			;TERMINAL DATA
	EXTERNAL G$SND			;PID OF SENDER
	EXTERNAL JOBNAM			;PROGRAM NAME BEING RUN
	SUBTTL	Table of Contents


;		Table of Contents for OPRLOG
;
;
;			   Section			      Page
;   1. Preliminaries. . . . . . . . . . . . . . . . . . . . .    1
;   2. Table of Contents. . . . . . . . . . . . . . . . . . .    2
;   3. Revision history . . . . . . . . . . . . . . . . . . .    3
;   4. Required data for logging. . . . . . . . . . . . . . .    4
;   5. L$INIT . . . . . . . . . . . . . . . . . . . . . . . .    6
;   6. L$NEWL - ROUTINE TO RENAME THE OLD LOG FILE TO A BACKUP   7
;   7. L$OPNL . . . . . . . . . . . . . . . . . . . . . . . .    8
;   8. L$ABORT. . . . . . . . . . . . . . . . . . . . . . . .    9
;   9. L$REL. . . . . . . . . . . . . . . . . . . . . . . . .   10
;  10. L$CLOS . . . . . . . . . . . . . . . . . . . . . . . .   11
;  11. L$EXIT . . . . . . . . . . . . . . . . . . . . . . . .   11
;  12. LOGCHK . . . . . . . . . . . . . . . . . . . . . . . .   12
;  13. L$CMD. . . . . . . . . . . . . . . . . . . . . . . . .   13
;  14. L$AOPR . . . . . . . . . . . . . . . . . . . . . . . .   14
;  15. L$DOPR . . . . . . . . . . . . . . . . . . . . . . . .   15
;  16. L$NTFY . . . . . . . . . . . . . . . . . . . . . . . .   17
;  17. L$SHWA . . . . . . . . . . . . . . . . . . . . . . . .   18
;  18. L$SHWM . . . . . . . . . . . . . . . . . . . . . . . .   19
;  19. L$ERR. . . . . . . . . . . . . . . . . . . . . . . . .   20
;  20. L$KMJB . . . . . . . . . . . . . . . . . . . . . . . .   20
;  21. L$WTO. . . . . . . . . . . . . . . . . . . . . . . . .   21
;  22. L$WTOR . . . . . . . . . . . . . . . . . . . . . . . .   21
;  23. L$ACK. . . . . . . . . . . . . . . . . . . . . . . . .   21
;  24. L$NACK . . . . . . . . . . . . . . . . . . . . . . . .   21
;  25. L$LOG. . . . . . . . . . . . . . . . . . . . . . . . .   22
;  26. LOGRTN . . . . . . . . . . . . . . . . . . . . . . . .   23
;  27. L$GSYS . . . . . . . . . . . . . . . . . . . . . . . .   24
;  28. L$SETF . . . . . . . . . . . . . . . . . . . . . . . .   25
SUBTTL	Revision history

COMMENT \

23			1-Feb-82
	Fix QAR 10-06813 at L$NACK

*****  Release 4.2 -- begin maintenance edits  *****

*****  Release 5.0 -- begin development edits  *****

30	5.1003		4-Jan-82
	Move to new development area.  Add version vector.  Clean up
edit organization.  Update TOC.

31	5.1048		24-Oct-83
	Increase the size of the backup FD so increases in the size
will fit.  Set the sizes of the log fds to unique names to prevent confusion.

32	5.1217		14-May-85
	Rename the operator log with a byte size of 7.

\   ;End of Revision History
	SUBTTL	Required data for logging

	SYSPRM	SYSNSZ,5,15		;SIZE OF SYSTEM NAME BLOCK

	$DATA	LOGSNM,SYSNSZ		;SAVE 10 WORDS FOR SYSTEM NAME
	$DATA	LOGIDN,1		;SAVE LOG LINE IDENT
	$GDATA	LOGOPN,1		;LOG FILE OPEN FLAG (-1 OPEN)
	$DATA	LOGIFN,1		;LOG FILE IFN
	$DATA	LOGMOR,1		;MORE TEXT COMING 

LOGFOB:	LOGFD				;LOG FILE FD ADDRESS
	EXP	7			;BYTE SIZE IS 7

LOGINT:: EXP	O.LENA			;ENABLE/DISABEL LOGGING VALUE

FRBBLK:	LOGFD				;OLD LOG FILE FD
	BACKUP				;NEW LOG FILE FD
	0,,0				;NO 
	0,,0				; ACCESS CHECK
	FR.NFO				;WANT NEW FILE ONLY

	EXTERN	NULTXT

EXTCNT:	EXP	-1			;FILE EXTENSION COUNTER
EXTPTR:	BLOCK	1			;FILE EXTENSION BYTE POINTER
BYTPTR:	BLOCK	1			;FILE EXTENSION BYTE POINTER
	;Define the primary operator log file FD

LOGFD::	LOGLN,,0			;FD BLOCK LENGTH
TOPS10<	DEFINE X(A),<SIXBIT/A/>		;DEFINE X MACRO FOR O$LOGN MACRO
	EXP	FSSSTR			;DEVICE FOR THE OPERATOR LOG
	EXP	O$LOGN			;FILENAME FOR THE LOG
	SIXBIT/LOG/			;.LOG EXTENSION
	3,,3				;SPOOL AREA
	LOGLN==.-LOGFD			;CALC THE BLOCK LENGTH
> ;END TOPS10 CONDITIONAL

TOPS20<	DEFINE X(A),<ASCIZ/PS:<SPOOL>'A'.LOG/>
	O$LOGN				;GEN THE LOG FILE NAME
	LOGLN==.-LOGFD			;CALC THE BLOCK LENGTH
> ;END TOPS20 CONDITIONAL

	;Define the backup operator log file FD

BACKUP:	BACKLN,,0			;FD BLOCK LENGTH
TOPS10<	DEFINE X(A),<SIXBIT/A/>		;DEFINE X MACRO FOR O$LOGN MACRO
	EXP	FSSSTR			;DEVICE FOR THE OPERATOR LOG
	EXP	O$LOGN			;FILENAME FOR THE LOG
	SIXBIT/000/			;.000 EXTENSION
	3,,3				;SPOOL AREA
	BACKLN==.-BACKUP		;CALC THE BLOCK LENGTH
> ;END TOPS10 CONDITIONAL

TOPS20<	DEFINE X(A),<ASCIZ/PS:<SPOOL>'A'-LOG.000/>
	O$LOGN				;GEN THE LOG FILE NAME
	BLOCK	<MXFSPC/5+1>-<.-BACKUP>	;Allocate to allow name to grow
					;  figure max words needed minus
					;  number of words already allocated
	BACKLN==.-BACKUP		;CALC THE BLOCK LENGTH
> ;END TOPS20 CONDITIONAL

	;Define the debugging operator log file FD

DEBFD:	DEBLN,,0			;FD BLOCK LENGTH
TOPS10<	DEFINE X(A),<SIXBIT/A/>		;DEFINE X MACRO FOR O$LOGN MACRO
	SIXBIT/DSK/			;SEND LOG FILE TO DSK:
	EXP	O$LOGN			;FILENAME FOR THE LOG
	SIXBIT/LOG/			;.LOG EXTENSION
	0,,0				;USERS AREA
	DEBLN==.-DEBFD			;CALC THE BLOCK LENGTH
> ;END TOPS10 CONDITIONAL

TOPS20<	DEFINE X(A),<ASCIZ/DSK:'A'.LOG/>
	O$LOGN				;GEN THE LOG FILE NAME
	DEBLN==.-DEBFD			;CALC THE BLOCK LENGTH
> ;END TOPS20 CONDITIONAL
	SUBTTL	L$INIT	Initialize the logfile

;THIS ROUTINE WILL SETUP THE NECESSARY DEFAULTS AND DO THE 
;RENAME OF THE OLD LOG FILE IF PRESENT.

L$INIT::SETZM	LOGOPN			;CLEAR LOG FILE OPEN FLAG
	MOVEI	S1,LOGFD		;GET THE LOG FILE FD ADDRESS
	SKIPE	DEBUGW			;DEBUGGING ???
	MOVEI	S1,DEBFD		;YES,,GET THE DEBUGGING FD ADDRESS
	MOVEM	S1,LOGFOB		;SAVE IT IN THE LOG FILE OPEN BLOCK

TOPS10<	MOVX	S1,%LDQUE		;GET THE SYSTEM QUEUE AREA
	GETTAB	S1,			;   FROM THE MONITOR
	  MOVE	S1,[3,,3]		;DEFAULT TO 3,,3
	MOVEM	S1,LOGFD+.FDPPN		;SET THE LOG FILE PPN
	SETOM	S1			;GET THE USERS
	GETPPN	S1,			;    PPN
	  JFCL				;BETTER SUCCEED !!!
	MOVEM	S1,DEBFD+.FDPPN		;SAVE THE PPN IN DEBUG FD
	MOVE	S1,LOGFD+.FDSTR		;GET THE STRUCTURE 
	MOVEM	S1,LOGSNM		;SAVE IT
	MOVE	S1,[5,,LOGSNM]		;GET DSKCHR PARMS
	DSKCHR	S1,			;GET THE PHYSICAL STRUCTURE NAME
	SKIPA	S1,LOGSNM		;FAILED,,GET THE ORIGIONAL STR NAME BACK
	MOVE	S1,LOGSNM+.DCSNM	;WIN,,GET THE REAL STRUCTURE NAME
	MOVEM	S1,LOGFD+.FDSTR		;SET IT IN THE LOG FD
	MOVEM	S1,BACKUP+.FDSTR	;SET IT IN THE BACKUP FD
	MOVE	S1,[POINT 6,BACKUP+.FDEXT]  ;GET THE OUTPUT FILE EXT POINTER
	MOVEM	S1,BYTPTR		;SAVE THE EXT BYTE POINTER
> ;END TOPS10 CONDITIONAL

TOPS20<	MOVX	S1,GJ%OFG+GJ%SHT	;PARSE-ONLY AND SHORT JFN 
	HRROI	S2,BACKUP+.FDFIL	;POINT TO THE LOG FILE FILE NAME
	GTJFN				;GET THE JFN
	$RETT				;FAILED,,JUST APPEND THE LOG FILE
	MOVE	S2,S1			;GET THE JFN IN S2
	HRROI	S1,BACKUP+.FDFIL	;POINT TO WHERE WE WANT THE FILE PUT
	MOVX	T1,<1B2+1B5+1B8+JS%PAF>	;WANT DEVICE+DIRECTORY+FILENAME
	JFNS				;GET IT
	ERJMP	.+2			;IF AN ERROR,,CONTINUE ONWARD
	MOVEM	S1,BYTPTR		;SAVE THE EXT BYTE POINTER
	MOVEI	S1,"."			;GET A PERIOD (FOR EXTENSION)
	IDPB	S1,BYTPTR		;SAVE IT
	MOVE	S1,S2			;GET THE JFN BACK
	RLJFN				;RELEASE IT
	JFCL				;IGNORE ANY ERROR
> ;END TOPS20 CONDITIONAL

	PUSHJ	P,L$NEWL		;RENAME THE OLD LOG FILE SPEC
	$RETT				;RETURN
	SUBTTL	L$NEWL - ROUTINE TO RENAME THE OLD LOG FILE TO A BACKUP

	;This routine renames the XXXXX.LOG operator log file to
	; XXXXX.nnn.

L$NEWL:	SKIPN	DEBUGW			;DEBUGGING ???
	SKIPN	BYTPTR			;ANY BYTE POINTER FOR FILE EXTENSIONS ?
	$RETF				;NO,,RETURN NOW

NEWL.1:	MOVE	S1,BYTPTR		;GET THE FILE EXTENSION BYTE PTR
	MOVEM	S1,EXTPTR		;SAVE IT
	AOS	S1,EXTCNT		;CREATE A NEW EXTENSION
	CAILE	S1,^D100		;CAN'T BE GREATER THEN 100
	JRST	NEWL.2			;YES,,TOO MANY LOG FILES !!!
	$TEXT	(SAVBYT,<^D3R0/S1/^0>)	;GEN THE FILE EXTENSION
	MOVEI	S1,5			;GET THE RENAME BLOCK LENGTH
	MOVEI	S2,FRBBLK		;GET THE RENAME BLOCK ADDRESS
	HRLI	S2,7			;Get the byte size
	PUSHJ	P,F%REN			;RENAME THE OPERATOR LOG FILE
	JUMPT	.RETT			;WIN,,RETURN
	CAXN	S1,ERFAE$		;WAS ERROR 'FILE ALREADY EXISTS' ???
	JRST	NEWL.1			;YES,,TRY NEXT FILE
	$WTO	(<Can't rename file ^F/LOGFD/>,<Current LOG file will be appended>,,<$WTFLG(WT.SJI)>)
	$RETF				;NO,,RETURN

NEWL.2:	$WTO	(<Too many operator LOG files>,<Current LOG file will be appended>,,<$WTFLG(WT.SJI)>)
	$RETF				;RETURN

SAVBYT:	
TOPS10<	SKIPE	S1			;SKIP IF NULL
	SUBI	S1,40	>		;CONVERT TO SIXBIT ON TOPS10
	IDPB	S1,EXTPTR		;SAVE THE BYTE
	$RETT				;RETURN
	SUBTTL	L$OPNL	Open the log file

;THIS ROUTINE WILL OPEN UP ORIONS LOG FILE TO LOG
;ALL MESSAGES TO AND FROM ORION

L$OPNL:: SKIPE	LOGOPN			;IS LOG FILE OPEN
	PJRST	E$LAO			;LOG FILE ALREADY OPEN
	MOVEI	S1,FOB.MZ		;SIZE OF FOB WITHOUT IN BEHALF
	MOVEI	S2,LOGFOB		;ADDRESS OF FILE OPEN BLOCK
	$CALL	F%AOPN			;OPEN IN APPEND MODE
	SKIPT				;MAKE SURE OPENED O.K.
	  PJRST	L$ABORT			;ABORT THE LOG FILE
	MOVEM	S1,LOGIFN		;SAVE IFN FOR FILE
	SETOM	LOGOPN			;LOG FILE OPEN FLAG
	$CALL	L$GSYS			;GET SYSTEM NAME
	MOVE	S1,LOGIFN		;GET THE IFN
	MOVX	S2,FI.SIZ		;LOAD FUNCTION CODE
	$CALL	F%INFO			;GET FILE SIZE
	SKIPE	S1			;FILE ALREADY EXIST?
	$TEXT	(LOGRTN,<^M^L^A>)	;YES - SEPARATE NEW LOG FROM OLD LOG
	MOVEI	T1,LOGFD		;ASSUME NOT DEBUGGING
	SKIPE	DEBUGW			;ARE WE?
	MOVEI	T1,DEBFD		;YES - POINT TO THE DEBUGGING FD
	$TEXT	(LOGRTN,<
	^H/G$NOW/ ORION version ^V/.JBVER/ beginning log file
	in ^F/(T1)/ for system ^T/LOGSNM/
>)
	PJRST	REQCHK			;REQUEST FIRST CHECKPOINT
					;AND RETURN
SUBTTL	L$ABORT	Abort the logfile

;This Routine will abort the Log File processing and continue on


L$ABORT: $CALL	.SAVE1			;SAVE AN AC
	SETZ	P1,0			;CLEAR IT
	EXCH	P1,LOGOPN		;GET THE VALUE AND RESET LOG FILE
	SETZM	LOGOPN			;CLEAR THE LOG OPEN FLAG
	$CALL	E$LFE			;LOG FILE ERRORS
	$CALL	ERRALL##		;GENERATE ERROR AND RETURN
	SKIPN	P1			;WAS LOG FILE OPEN
	$RETF				;RETURN FALSE
	MOVE	S1,LOGIFN		;GET THE IFN
	$CALL	F%REL			;CLOSE THE FILE
	JUMPT	.RETF			;O.K. JUST RETURN
	PJRST	L$ABORT			;LOG THIS ERROR ALSO AND RETURN
SUBTTL	L$REL	Release the logfile

;THIS ROUTINE WILL CLOSE THE LOG 

L$REL:: $CALL	LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE ERRORS
	MOVE	S1,LOGIFN		;GET THE LOG FILE IFN
	$CALL	F%REL			;CLOSE THE FILE
	SKIPT				;SKIP IF O.K.
	  PJRST	L$ABORT			;ABORT LOG FILE
	SETZM	LOGOPN			;LOG FILE CLOSED
	$RETT				;RETURN
	SUBTTL	L$CLOS	Close the logfile

	;This routine closes the XXX.LOG file and renames it to XXX.nnn and
	;   Then re-opens the XXX.LOG file to continue logging.

L$CLOS:: $CALL	RELPAG##		;RETURN MESSAGE PAGE
	SKIPN	LOGINT			;LOGGING ENABLED??
	PJRST	E$LNI##			;LOGGING NOT ENABLED
	SKIPN	LOGOPN			;IS LOG FILE OPEN
	$RETT				;IGNORE IT
	PUSHJ	P,L$CHKP		;CHECKPOINT THE LOG FILE
	PUSHJ	P,L$REL			;RELEASE THE OLD LOG FILE
	PUSHJ	P,L$NEWL		;RENAME THE OLD LOG FILE
	SKIPF				;WIN ???
	$WTO	(<Operator log file ^F/LOGFD/>,<  Has been renamed to ^F/BACKUP/>,,<$WTFLG(WT.SJI)>)
	PUSHJ	P,L$OPNL		;OPEN THE NEW LOG FILE
	$RETT				;AND RETURN


L$CHKP::$CALL	LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
	MOVE	S1,LOGIFN		;GET THE IFN
	$CALL	F%CHKP			;CHECKPOINT THE FILE
	JUMPF	L$ABORT			;ABORT ON ERROR
REQCHK:	MOVX	S1,<%CHKTM*^D60*^D1000>	;GET CHECKPOINT INTERVAL
	MOVEI	S2,L$CHKP		;CALL ME AGAIN
	$CALL	REQTIM##		;FROM CHKTIM
					;FALL INTO COMMON EXIT


SUBTTL	L$EXIT	Return to the caller

L$EXIT:	$RETT				;JUST RETURN
SUBTTL	LOGCHK	Check the logfile status

;THIS ROUTINE WILL CHECK IF LOGGING IS ENABLED AS WELL AS IF THE LOG
;FILE IS OPEN ALREADY.

LOGCHK:	SKIPE	LOGINT			;LOGGING ENABLED?
	SKIPN	LOGOPN			;LOG FILE OPEN
	$RETF				;NO..RETURN FALSE
	$RETT				;YES..RETURN O.K.
SUBTTL	L$CMD	Log an operator command

;THIS ROUTINE WILL LOG ALL COMMAND MESSAGES THAT COME FROM A VALID OPR

L$CMD:: $CALL	LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE ERRORS
	LOAD	S1,G$JOB		;GET JOB NUMBER
	$CALL	GETJBT##		;GET JOB DATA
	MOVE	S1,G$OPRA		;GET OPER ADDRESS
	MOVE	S1,OPR.ND(S1)		;NODE ADDRESS
	$TEXT	(LOGRTN,<^C/G$NOW/ OPRCMD from ^W/JOBNAM/ node ^N/NOD.NM(S1)/ ^I/@JOBTER/>)
	MOVE	S1,COM.CM(MI)		;GET OFFSET FOR TEXT
	ADDI	S1,ARG.DA(MI)		;GET ADDRESS OF TEXT
	$TEXT	(LOGRTN,<		=^7/[76]/^T/(S1)/^A>)
	PJRST	L$EXIT			;GOOD RETURN..


LOGHDR:	ITEXT	(<^C/G$NOW/ ^W/LOGIDN/ ^I/@JOBTXT/ running ^W/JOBNAM/
	>)
SUBTTL	L$AOPR	Log an OPR signon

;THIS ROUTINE WILL LOG THE SIGNON OF AN OPR

L$AOPR:: $CALL	LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
	LOAD	S1,G$JOB		;GET JOB NUMBER
	$CALL	GETJBT			;GE JOB INFO
	MOVE	S1,G$OPRA		;GET OPR ADDRESS
	MOVE	S2,OPR.ND(S1)		;GET NODE ADDRESS
	$TEXT	(LOGRTN,<^C/G$NOW/ OPRHEL OPR signon from ^W/JOBNAM/ version ^V/OPH.VN+.OHDRS(MI)/ (PID=^O/G$SND/)
		^I/@JOBTXT/ node ^N/NOD.NM(S2)/>)
	PJRST	L$EXIT			;GOOD RETURN..
SUBTTL	L$DOPR	Log the deletion of an OPR

;THIS ROUTINE WILL LOG THE DELETION OF AN OPR

L$DOPR:: $CALL	LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
	MOVE	S1,G$OPRA		;GET OPR ADDRESS
	MOVE	S2,OPR.ND(S1)		;GET NODE ADDRESS
	$TEXT	(LOGRTN,<^C/G$NOW/ OPRDEL OPR deleted ^I/OPRDAT/>)
	PJRST	L$EXIT			;GOOD RETURN..
OPRDAT:	ITEXT	(<at terminal ^O/OPR.TN(S1)/ node ^N/NOD.NM(S2)/ (PID=^O/OPR.PD(S1)/)>)
SUBTTL	L$NTFY	Log a notify message

;THIS ROUTINE WILL LOG THE NOTIFY MESSAGE

L$NTFY:: $CALL	LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
	MOVE	S1,[SIXBIT/OPRNFY/]	;NOTIFY MESSAGE
	MOVEM	S1,LOGIDN		;SAVE IDENTIFIER
	LOAD	S1,G$JOB		;GET JOB NUMBER
	$CALL	GETJBT			;GET SENDERS INFO
	$TEXT	(LOGRTN,<^I/LOGHDR/^A>)	;PUT OUT THE HEADER
	LOAD	S1,.OHDRS+JBI.JB(MI)	;GET JOB NUMBER OF SENDER
	$CALL	GETJBT			;GET JOB INFO
	$TEXT	(LOGRTN,<	For: ^I/@JOBTXT/
		^T/.OHDRS+JBI.SZ+ARG.DA(MI)/>)
	PJRST	L$EXIT			;CHECKPOINT AND RETURN
SUBTTL	L$SHWA	Log a standard ACK from QUASAR

;THIS ROUTINE WILL LOG AN ACK FROM QUASAR

L$SHWA:: $CALL	LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
	SKIPE	LOGMOR			;CHECK IF EXPECTING MORE FROM MESSAGE
	JRST	SHWM.1			;YES.. PROCESS MESSAGE
	$TEXT	(LOGRTN,<^C/G$NOW/ OPRSHA ^A>)
	PJRST	SHWM.1			;YES..PROCESS THE MESSAGE
SUBTTL	L$SHWM	Log an OPR display message



L$SHWM:: $CALL	LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
	SKIPE	LOGMOR			;CHECK IF EXPECTING MORE FROM MESSAGE
	JRST	SHWM.1			;YES.. JUST PROCESS MESSAGE
	$TEXT	(LOGRTN,<^C/G$NOW/ OPRSHM ^A>)
SHWM.1:	MOVE	T1,.OARGC(MO)		;GET ARGUMENT COUNT
	MOVEI	T2,.OHDRS+ARG.HD(MO)	;ADDRESS OF FIRST ARGUMENT
SHWM.2:	LOAD	S1,ARG.HD(T2),AR.TYP	;GET THE TYPE FIELD
	CAIE	S1,.ORDSP		;IS IT DISPLAY
	JRST	SHWM.4			;NO CHECK FOR TEXT
	$TEXT	(LOGRTN,<^M^J	^A>);POSITION DATA
	MOVEI	S1,ARG.DA+1(T2)		;ADDRESS OF THE TEXT
SHWM.3:	$TEXT	(LOGRTN,<^T/(S1)/^A>)	;DUMP THE BLOCK
	LOAD	S2,ARG.HD(T2),AR.LEN	;GET LENGTH OF BLOCK
	ADD	T2,S2			;BUMP TO NEXT BLOCK
	SOJG	T1,SHWM.2		;GET NEXT BLOCK
	SETZM	LOGMOR			;CLEAR LOGMOR FLAG
	MOVX	S1,WT.MOR		;GET THE MORE BIT
	TDNE	S1,.OFLAG(MO)		;WAS IT SET
	SETOM	LOGMOR			;YES..SET FLAG
	PJRST	L$EXIT			;GOOD RETURN..
SHWM.4:	CAIE	S1,.CMTXT		;WAS IT JUST TEXT
	$STOP(IDM,<Invalid Display Message Type ^D/S1/>)
	MOVEI	S1,ARG.DA(T2)		;ADDRESS OF TEXT
	JRST	SHWM.3			;OUTPUT THE TEXT
SUBTTL	L$ERR	Log a command error message


L$ERR:: $CALL	LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
	MOVE	S1,[SIXBIT/OPRERR/]	;OPR ERROR MESSAGE
	HRRZ	S2,G$ERR		;GET CODE VALUE
	CAIL	S2,GOODMS		;GOOD MESSAGE?
	MOVE	S1,[SIXBIT/OPRMSG/]	;WRITE AS OPR MESSAGE
	MOVEM	S1,LOGIDN		;SAVE IDENTIFIER
	LOAD	S1,G$JOB		;GET JOB NUMBER
	$CALL	GETJBT##		;GET THE JOB DATA
	MOVEI	S2,NULTXT		;NUL ITEXT BLOCK
ERR.1:	SKIPGE	S1,G$ERR##		;GET ERROR CODE
	JRST	ERR.2			;PROCESS AS ITEXT
	$TEXT	(LOGRTN,<^I/LOGHDR/^I/(S2)/	--^T/@TXTTBL(S1)/-->)
	PJRST	L$EXIT			;GOOD RETURN..
ERR.2:	$TEXT	(LOGRTN,<^I/LOGHDR/^I/(S2)/	--^I/@TXTTBL(S1)/-->)
	PJRST	L$EXIT			;GOOD RETURN..


L$KMES:: $CALL	LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
	MOVE	S1,[SIXBIT/OPRCMS/]	;GET LINE ID
	MOVEM	S1,LOGIDN		;SAVE LINE ID
	MOVEI	S2,[ITEXT(< 		WTOR code = ^O/.MSCOD(MI)/>
	)]
	JRST	ERR.1			;PROCESS MESSAGE

SUBTTL	L$KMJB	Log a kill message for job on LOGOUT

L$KMJB:: $CALL	LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
	MOVE	S1,[SIXBIT/OPRKMJ/]	;KILLED MESSAGE FOR JOB
	MOVEM	S1,LOGIDN		;SAVE LINE ID
	MOVE	S1,G$ERR		;GET THE ERROR CODE
	$TEXT	(LOGRTN,<^C/G$NOW/ ^W/LOGIDN/ ^I/@TXTTBL(S1)/>)
	PJRST	L$EXIT			;GOOD RETURN..
SUBTTL	L$WTO	Log a WTO message


L$WTO:: $CALL	LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
	MOVE	S1,[SIXBIT/OPRWTO/]	;WTO TYPE MESSAGE
	MOVEM	S1,LOGIDN		;SAVE LINE ID
WTOLOG:	LOAD	S1,G$JOB		;GET JOB NUMBER
	$CALL	GETJBT##		;GET THE JOB DATA
	$TEXT	(LOGRTN,<^I/LOGHDR/^T/ARG.DA+.OHDRS+1(MO)/^A>)
	PJRST	L$EXIT			;GOOD RETURN..




SUBTTL	L$WTOR	Log a WTOR message


L$WTOR:: $CALL	LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
	MOVE	S1,[SIXBIT/OPRWTR/]	;WTO TYPE MESSAGE
	MOVEM	S1,LOGIDN		;SAVE LINE ID
	LOAD	S1,G$JOB		;GET JOB NUMBER
	$CALL	GETJBT##		;GET THE JOB DATA
	$TEXT	(LOGRTN,<^I/LOGHDR/		WTOR code = ^O/.MSCOD(MI)/
	^T/ARG.DA+.OHDRS+1(MO)/^A>)
	PJRST	L$EXIT			;GOOD RETURN..



SUBTTL	L$ACK	Log an ACK message


L$ACK:: $CALL	LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
	MOVE	S1,[SIXBIT/OPRACK/]	;WTO TYPE MESSAGE
	MOVEM	S1,LOGIDN		;SAVE LINE ID
	PJRST	WTOLOG			;LOG THE WTO MESSAGE


SUBTTL	L$NACK	Log a null ACK message

L$NACK:: $CALL	LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
	LOAD	S1,G$JOB		;GET JOB NUMBER
	$CALL	GETJBT##		;GET THE JOB INFO
	MOVE	S1,[SIXBIT/OPRACK/]	;WTO TYPE MESSAGE
	MOVEM	S1,LOGIDN		;SAVE LINE ID
	$TEXT	(LOGRTN,<^I/LOGHDR/>)	;JUST THE HEADER
	PJRST	L$EXIT			;GOOD RETURN..
SUBTTL	L$LOG	Log a LOG message 

L$LOG:: $CALL	LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
	MOVE	S1,[SIXBIT/OPRLOG/]	;WTO TYPE MESSAGE
	MOVEM	S1,LOGIDN		;SAVE LINE ID
	PJRST	WTOLOG			;LOG THE MESSAGE
SUBTTL	LOGRTN	Text Output routine for logfile writing

;This routine is called with a character to write in S1


LOGRTN:	MOVE	S2,S1			;PUT CHARACTER IN S2
	MOVE	S1,LOGIFN		;GET THE LOG FILE IFN
	$CALL	F%OBYT			;OUTPUT THE BYTE
	$RETIT				;RETURN IF O.K.
	  PJRST	L$ABORT			;ABORT LOG FILE
SUBTTL	L$GSYS	Log the system name

TOPS10<

L$GSYS:	MOVEI	T3,SYSNSZ		;NUMBER OF WORDS IN SYSNAM - 1
	MOVS	T1,[%CNFG0]		;ADR OF FIRST WORD
GSYS.1:	MOVS	T2,T1			;GET THE GETTAB ADR
	GETTAB	T2,			;GET THE WORD
	  JFCL				;IGNORE THIS
	MOVEM	T2,LOGSNM(T1)		;SAVE NAME
	CAILE	T3,(T1)			;DONE?
	AOJA	T1,GSYS.1		;NO, LOOP
>  ;END TOPS10

TOPS20<

L$GSYS:	MOVX	S1,'SYSVER'		;NAME OF GETTAB FOR SYSNAME
	SYSGT				;GET IT
	HRLZ	T1,S2			;GET TABLE#,,0
	MOVEI	T2,SYSNSZ		;AND LOAD LOOP COUNTER
GSYS.1:	MOVS	S1,T1			;GET N,,TABLE#
	GETAB				;GET THE ENTRY
	  MOVEI	S1,0			;USE ZERO IF LOSING
	MOVEM	S1,LOGSNM(T1)		;STORE THE RESULT
	CAILE	T2,(T1)			;DONE ENUF?
	AOJA	T1,GSYS.1		;NO, LOOP
>;END TOPS20


GSYS.2:	MOVE	S1,[POINT 7,LOGSNM]	;SET UP BYTE POINTER

GSYS.3:	ILDB	T1,S1			;GET A CHARACTER
	CAIE	T1,.CHTAB		;A TAB?
	CAIN	T1," "			;A SPACE?
	JRST	GSYS.3			;YES TO EITHER
	SKIPA	S2,[POINT 7,LOGSNM]	;SET UP STORAGE BYTE POINTER

GSYS.4:	ILDB	T1,S1			;GET A CHARACTER
	IDPB	T1,S2			;PUT A CHARACTER
	JUMPN	T1,GSYS.4		;LOOP UNTIL END OF STRING
	POPJ	P,			;RETURN
SUBTTL	L$SETF	Log a setup failure message


L$SETF:: $CALL	LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
	MOVE	T1,S1			;ADDRESS OF THE TEXT
	MOVE	S1,G$OPRA		;GET OPR ADDRESS
	MOVE	S2,OPR.ND(S1)		;GET NODE ADDRESS
	$TEXT	(LOGRTN,<^C/G$NOW/ OPRSFL OPR setup failure  ^I/OPRDAT/
		Reason: ^T/(T1)/>)
	PJRST	L$EXIT			;GOOD RETURN..

	END				;END OPRLOG