Google
 

Trailing-Edge - PDP-10 Archives - bb-jr93d-bb - 7,6/ap016/oprlog.x16
There are 2 other files named oprlog.x16 in the archive. Click here to see a list.
TITLE	OPRLOG	ORION MODULE FOR BUILDING THE ORION LOG FILE
SUBTTL	Murray Berkowitz/PJT	12-SEP-85


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

	SEARCH	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


	%%.OPR==:%%.OPR			;GET ORNMAC'S VERSION
	OPRVRS==:OPRVRS			;GET OPR/ORION'S VERSION

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

	$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/
>)
	MOVEI	S2,1(P)			;GET ADDRESS OF AN ARG BLOCK TO-BE
	ADJSP	P,.TIMPC+1		;ALLOCATE ONE
	MOVEI	S1,.TIMBF		;DELETE PENDING REQUESTS "BEFORE"
	MOVEM	S1,.TIFNC(S2)		;AND INCLUDING THE TIME WE WANT TO ADD
	HLLO	S1,G$NOW		;GET LAST INSTANT OF TODAY
	ADDI	S1,2			;GET SECOND INSTANT OF TOMORROW
	MOVEM	S1,.TITIM(S2)		;SAVE "BEFORE" TIME
	MOVEI	S1,NEWDAY		;THE PC TO REMOVE
	MOVEM	S1,.TIMPC(S2)		;SPECIFY THAT
	MOVEI	S1,.TIMPC+1		;LENGTH OF ARG BLOCK
	$CALL	I%TIMR			;REMOVE ANY PAST ENTRIES
	ADJSP	P,-<.TIMPC+1>		;AND TOSS ARG BLOCK
	HLLO	S1,G$NOW		;GET LAST INSTANT OF TODAY
	AOJ	S1,			;FIRST THING TOMORROW MORNING
	MOVEI	S2,NEWDAY		;CALL THIS ROUTINE
	PUSHJ	P,REQTIM##		;REQUEST A TIMER INTERRUPT THEN
	PJRST	REQCHK			;REQUEST FIRST CHECKPOINT
					;AND RETURN
SUBTTL	NEWDAY	Routine to deal with a new day

;THIS ROUTINE IS CALLED 1X/DAY TO MAKE A DATE ENTRY IN THE .LOG FILE.
;THIS ENSURES THAT NO MATTER WHEN LOG FILE CLOSURES HAPPEN, THERE IS A
;DATE REFERENCE FOR EACH TIMESTAMP IN THE FILE.

NEWDAY:	SKIPN	LOGOPN			;LOG FILE STILL OPEN?
	 $RETT				;NO, DON'T BOTHER TO CONTINUE
	$CALL	I%NOW			;GET TIME NOW
	HLLOS	S1			;GET LAST INSTANT OF TODAY
	AOJ	S1,			;FIRST THING TOMORROW MORNING
	MOVEI	S2,NEWDAY		;CALL THIS ROUTINE
	PUSHJ	P,REQTIM##		;REQUEST A TIMER INTERRUPT THEN
	MOVEI	T1,LOGFD		;ASSUME NOT DEBUGGING
	SKIPE	DEBUGW			;ARE WE?
	MOVEI	T1,DEBFD		;YES - POINT TO THE DEBUGGING FD
	$TEXT	(LOGRTN,<
	^H/[-1]/ ORION version ^V/.JBVER/ continuing log file
	^F/(T1)/ for system ^T/LOGSNM/
>)
	$RETT
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::SKIPN	LOGINT			;LOGGING ENABLED??
	JRST	CLOS.1			;NO
	SKIPN	LOGOPN			;IS LOG FILE OPEN??
	JRST	CLOS.2			;NO
	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
	SETZM	S1			;USE S1 AS A FLAG FOR A SECOND
	SKIPF				;WIN ???
	MOVEI	S1,[ITEXT(< Log file ^F/LOGFD/ renamed to ^F/BACKUP/ >)]
	SKIPE	S1			;ITEXT ADDRESS?
	PUSHJ	P,DOAOP##		;YES, SEND MESSAGE TO ALL OPRS
	PUSHJ	P,L$OPNL		;OPEN THE NEW LOG FILE
	$RETT				;AND RETURN

CLOS.1:	SKIPA	S1,[[ITEXT(< Log file not closed, logging is not enabled >)]]
CLOS.2:	MOVEI	S1,[ITEXT(< Log file not closed, log file was not open >)]
	PJRST	DOAOP##			;SEND MESSAGE TO ALL OPRS

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/^M^J		=^7/[76]/^A>)
	MOVE	S1,COM.CM(MI)		;GET OFFSET FOR TEXT
	ADDI	S1,ARG.DA(MI)		;GET ADDRESS OF TEXT
	HRLI	S1,(POINT 7,)		;MAKE A BYTE POINTER
	PUSH	P,S1			;SAVE IT
	PUSH	P,[EXP 0]		;INIT FLAG
CMD.1:	ILDB	S1,-1(P)		;GET A CHARACTER
	JUMPE	S1,CMD.2		;DONE?
	AOSN	(P)			;LAST CHARACTER A LINE FEED?
	$TEXT	(LOGRTN,<		  ^A>)
	CAIN	S1,.CHLFD		;EOL?
	SETOM	(P)			;YES--REMEMBER
	PUSHJ	P,LOGRTN		;PUT A CHARACTER
	JRST	CMD.1			;LOOP
CMD.2:	ADJSP	P,-2			;TRIM STACK
	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
	STOPCD	(IDM,HALT,,<Invalid Display Message Type in 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
	SKIPE	S1,G$APFG		;APPLICATION?
	 JRST	ERR.1			;YES, GO GET SUFFIX
	HRRI	S1,'ERR'		;OPR ERROR MESSAGE
	HRRZ	S2,G$ERR		;GET CODE VALUE
	CAIL	S2,GOODMS		;GOOD MESSAGE?
	HRRI	S1,'MSG'		;WRITE AS OPR MESSAGE
ERR.1:	HRLI	S1,'OPR'		;GET THE PREFIX
	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.2:	SKIPE	G$APFG			;APPLICATION MESSAGE?
	 JRST	ERR.4			;YES, GO HANDLE IT
	SKIPGE	S1,G$ERR##		;GET ERROR CODE
	JRST	ERR.3			;PROCESS AS ITEXT
	$TEXT	(LOGRTN,<^I/LOGHDR/^I/(S2)/	--^T/@TXTTBL(S1)/-->)
	PJRST	L$EXIT			;GOOD RETURN..
ERR.3:	$TEXT	(LOGRTN,<^I/LOGHDR/^I/(S2)/	--^I/@TXTTBL(S1)/-->)
	PJRST	L$EXIT			;GOOD RETURN..
ERR.4:	$TEXT	(LOGRTN,<^I/LOGHDR/^I/(S2)/	--^T/@G$ERR/-->)
	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.2			;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
	SKIPE	G$APFG##		;APPLICATION MESSAGE?
	JRST	KMJB.1			;YES, HANDLE DIRECTLY
	$TEXT	(LOGRTN,<^C/G$NOW/ ^W/LOGIDN/ ^I/@TXTTBL(S1)/>)
	PJRST	L$EXIT			;GOOD RETURN..

KMJB.1:	$TEXT	(LOGRTN,<^C/G$NOW/ ^W/LOGIDN/ ^I/@TXTTBL(S1)/>)
	PJRST	L$EXIT
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	L$AUTO	Log a Auto-file message from QUASAR


L$AUTO::PUSHJ	P,LOGCHK		;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
	MOVE	S1,[SIXBIT/OPRATO/]	;WTO TYPE MESSAGE
	MOVEM	S1,LOGIDN		;SAVE LINE ID
	$TEXT	(LOGRTN,<^I/ATOHDR/-- ^I/(T1)/ -->)
	SKIPE	(T2)			;NULL?
	$TEXT	(LOGRTN,<		^I/(T2)/>)
	PJRST	L$EXIT			;FINISH UP

ATOHDR:	ITEXT	(<^C/G$NOW/ ^W/LOGIDN/	>)

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