Google
 

Trailing-Edge - PDP-10 Archives - bb-d868e-bm_tops20_v41_2020_dist_1of2 - language-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	Murray Berkowitz/PJT	1-Jan-82


;
;
;          COPYRIGHT (c) 1975,1976,1977,1978,1979,1980,1982
;                    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(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

	LOGEDT==:23			;LOG 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

	REVISION HISTORY

1	OPRLOG	Dec-5-78		OPRLOG Version Number added
2	OPRLOG	Dec-26-78		Add L$SETF for OPR Setup Failure Text
3	OPRLOG	Jan-15-79		Remove Checkpoint in L$EXIT
4	OPRLOG	Jan-16-79		Add Timer for Checkpoint in L$EXIT
5	OPRLOG	Jan-23-79		Add LOG Open Flag and Centralise the
					Entry to all Log Routines
					and Make all Routines use L$EXIT
6	OPRLOG	Mar-1-79		Change L$ERR to use header of OPRERR
					or OPRMSG
7	OPRLOG	Mar-9-79		Add Rename for Initialization and create
					L$INIT to setup FD and do RENAME if not
					Debugging
10	OPRLOG	Apr-6-79		Clear LOGOPN in L$INIT
11	OPRLOG	Aug-9-79		Have -10 init routine use FSSSTR for 
					both parts of RENAME
12	OPRLOG	Sept-11-79		Remove Log file Stopcodes and Generate 
					Errors to all
13	OPRLOG	Oct-8-79		Check log status in L$CHKP before doing
					the checkpoint
14	OPRLOG	Apr-28-80		Use REQTIM for checkpoint

15	OPRLOG	20-May-80		Request checkpoint using
					elapsed time function

16	OPRLOG	2-OCT-80		CHANGE LOGGING ROUTINES SO THAT A NEW
					LOG FILE IS GENERATED WHEN THE CLOSE
					COMMAND IS USED AND WHEN ORION STARTS UP

17	OPRLOG	22-Oct-80		Use ^N instead of ^W for node names

20	OPRLOG	10-Feb-81		Change all calls for GETJOB to GETJBT
					so we put node information into the log
					Also remove the pid from OPR command
					logging.

21	OPRLOG	27-Apr-81		Fix operator logging on the -20

22	OPRLOG	27-Nov-81		Clean up log file header. Display the
					correct filespec. Don't output a form-
					feed at the begining if it's not needed

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

.
\


	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. Table of Contents.........................................   2
;    2. Required data for logging.................................   3
;    3. L$INIT  Initialize the logfile............................   5
;    4. L$NEWL - ROUTINE TO RENAME THE OLD LOG FILE TO A BACKUP...   6
;    5. L$OPNL  Open the log file.................................   7
;    6. L$ABORT Abort the logfile.................................   8
;    7. L$REL   Release the logfile...............................   9
;    8. L$CLOS  Close the logfile.................................  10
;    9. L$EXIT  Return to the caller..............................  10
;   10. LOGCHK  Check the logfile status..........................  11
;   11. L$CMD   Log an operator command...........................  12
;   12. L$AOPR  Log an OPR signon.................................  13
;   13. L$DOPR  Log the deletion of an OPR........................  14
;   14. L$NTFY  Log a notify message..............................  15
;   15. L$SHWA  Log a standard ACK from QUASAR....................  16
;   16. L$SHWM  Log an OPR display message........................  17
;   17. L$ERR   Log a command error message.......................  18
;   18. L$KMJB  Log a kill message for job on LOGOUT..............  18
;   19. L$WTO   Log a WTO message.................................  19
;   20. L$WTOR  Log a WTOR message................................  19
;   21. L$ACK   Log an ACK message................................  19
;   22. L$NACK  Log a null ACK message............................  19
;   23. L$LOG   Log a LOG message.................................  20
;   24. LOGRTN  Text Output routine for logfile writing...........  21
;   25. L$GSYS  Log the system name...............................  22
;   26. L$SETF  Log a setup failure message.......................  23
	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::	BLKLEN,,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
	BLKLEN==.-LOGFD			;CALC THE BLOCK LENGTH
> ;END TOPS10 CONDITIONAL

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

	;Define the backup operator log file FD

BACKUP:	BLKLEN,,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
	BLKLEN==.-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
	BLKLEN==.-BACKUP+1		;CALC THE BLOCK LENGTH
> ;END TOPS20 CONDITIONAL

	;Define the debugging operator log file FD

DEBFD:	BLKLEN,,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
	BLKLEN==.-DEBFD			;CALC THE BLOCK LENGTH
> ;END TOPS10 CONDITIONAL

TOPS20<	DEFINE X(A),<ASCIZ/DSK:'A'.LOG/>
	O$LOGN				;GEN THE LOG FILE NAME
	BLKLEN==.-DEBFD+1		;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
	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