Google
 

Trailing-Edge - PDP-10 Archives - bb-lw55a-bm - 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, 1988.
;	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 THAT IS NOT SUPPLIED BY DIGITAL.

	SEARCH	GLXMAC,ORNMAC,QSRMAC,NEBMAC
	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 NEBSTR			;[42]NEBULA MESSAGE TEXT TABLE
	EXTERNAL TABSRC			;[42]TABLE SEARCH ROUTINE
	EXTERNAL N$FBLK			;[43]FIND AN ARGUMENT BLOCK
	EXTERNAL .JBVER			;VERSION LOCATION INFO

;Version numbers

	LOGMAN==:0			;Maintenance edit number
	LOGDEV==:52			;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. LOGCHK . . . . . . . . . . . . . . . . . . . . . . . .   12
;  12. L$CMD. . . . . . . . . . . . . . . . . . . . . . . . .   13
;  13. L$AOPR . . . . . . . . . . . . . . . . . . . . . . . .   14
;  14. L$DOPR . . . . . . . . . . . . . . . . . . . . . . . .   15
;  15. L$NTFY . . . . . . . . . . . . . . . . . . . . . . . .   17
;  16. L$SHWA . . . . . . . . . . . . . . . . . . . . . . . .   18
;  17. L$NRSW - Log a remote display message. . . . . . . . .   19
;  18. L$NLSW - Log a display message that originated from a remote node  20
;  19. L$SHWM . . . . . . . . . . . . . . . . . . . . . . . .   21
;  20. L$ERR. . . . . . . . . . . . . . . . . . . . . . . . .   22
;  21. L$KMJB . . . . . . . . . . . . . . . . . . . . . . . .   22
;  22. L$NERR - Log a NEBULA related command error message. .   23
;  23. L$WTO. . . . . . . . . . . . . . . . . . . . . . . . .   24
;  24. L$WTOR . . . . . . . . . . . . . . . . . . . . . . . .   24
;  25. L$ACK. . . . . . . . . . . . . . . . . . . . . . . . .   24
;  26. L$NACK . . . . . . . . . . . . . . . . . . . . . . . .   24
;  27. L$LOG. . . . . . . . . . . . . . . . . . . . . . . . .   25
;  28. L$NWTO - Log a REMOTE WTO message. . . . . . . . . . .   26
;  29. L$LWTO - Log locally a WTO message that originated remotely  27
;  30. L$RACK . . . . . . . . . . . . . . . . . . . . . . . .   28
;  31. L$LACK - Log an ACK message that came from a remote node   29
;  32. L$NEB - Log a NEBULA message . . . . . . . . . . . . .   30
;  33. LOGRTN . . . . . . . . . . . . . . . . . . . . . . . .   31
;  34. L$GSYS . . . . . . . . . . . . . . . . . . . . . . . .   32
;  35. L$SETF . . . . . . . . . . . . . . . . . . . . . . . .   33
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.

*****  Release 5 -- begin maintenance edits  *****

35	Increment maintenance edit level for GALAXY 5.

*****	Release 6.0 -- begin development edits	*****

40	6.1037		26-Oct-87
	Move sources from G5: to G6:

41	6.1057		4-Nov-87
	Change PS: to BS: and PS:[SPOOL] to SPOOL: for Non PS: login feature.

42	6.1094		20-Nov-87
	Add new routines to log messages that originated from a remote node
in the cluster, that were processed on a remote node in the cluster and
that came back from a remote node in the cluster.

43	6.1136		9-Dec-87
	Change L$NEB to correctly pick up the node name of the node where
the remote message originated from.

44	6.1138		13-Dec-87
	Add routine L$RERR to log error messages that originated from a remote
ORION. Change routine L$LACK to display the node name properly.
	
45	6.1163		6-Jan-88
	Do a first pass at cleaning up the display of remote messages.

46	6.1196		27-Feb-88
	Allow block type .ORRFG to be a valid block type in display messages.

47	6.1198		27-Feb-88
	For remote error messages, include a final CR-LF in the last display
block.

50	6.1210		2-Mar-88
	Change L$NEB not to indicate "unknown message involving NEBULA" if
the message does not contain a .NDENM block since not all messages involving
NEBULA have this block.

51	6.1213		3-Mar-88
	Indicate the job user name instead of OPR or OPERATOR in log file
headers. Also, display the message text for OPRERR entries of remote OPR
requests.

52	6.1225		8-Mar-88
	Update copyright notice.

\   ;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 
	$DATA	REMERR,1		;[47]REMOTE ERROR FLAG

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/SPOOL:'A'.LOG/> ;[41]
	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/SPOOL:'A'-LOG.000/> ;[41]
	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	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 ^I/@JOBTXT/ node ^N/NOD.NM(S1)/ running ^W/JOBNAM/>) ;[51]
	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>)
	$RETT				;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)/>)
	$RETT				;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		;[51]GET OPR ADDRESS
	MOVE	S1,OPR.JB(S1)		;[51]PICK UP THE JOB NUMBER
	$CALL	GETJBT##		;[51]GET JOB DATA
	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/>)
	$RETT				;GOOD RETURN..

OPRDAT:	ITEXT	(<^I/@JOBTXT/ node ^N/NOD.NM(S2)/ (PID=^O/OPR.PD(S1)/)>) ;[51]]
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)/>)
	$RETT				;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$NRSW - Log a remote display message

;L$NRSW LOGS A DISPLAY MESSAGE THAT ORIGINATED FROM A REMOTE NODE IN THE
;CLUSTER

L$NRSW::$CALL	LOGCHK			;[42]CHECK THE LOG STATUS
	JUMPF	.RETT			;[42]IGNORE ANY ERRORS
	$TEXT	(LOGRTN,<^C/G$NOW/  OPRSHA - Request originated from node ^N/.OHDRS+ARG.DA(MO)/ ^A>)
	MOVE	T1,.OARGC(MO)		;[42]PICK UP THE NUMBER OF ARG BLOCKS
	SOS	T1			;[42]DISREGARD THE FIRST DISPLAY BLOCK
	LOAD	T2,.OHDRS(MO),AR.LEN	;[42]PICK UP THE LENGTH OF DISPLAY BLK
	ADDI	T2,.OHDRS(MO)		;[42]POINT TO SECOND DISPLAY BLOCK
	PJRST	SHWM.2			;[42]GO LOG THE MESSAGE
	SUBTTL	L$NLSW - Log a display message that originated from a remote node

;L$NLSW logs a REMOTE SHOW ACK message that originated from a remote node

L$NLSW::$CALL	LOGCHK			;[42]CHECK THE LOG STATUS
	JUMPF	.RETT			;[42]IGNORE ANY ERRORS
	PJRST	SHWM.0			;[42]GO LOG 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
SHWM.0:	$TEXT	(LOGRTN,<^C/G$NOW/ OPRSHM ^A>) ;[42]
SHWM.1:	SETZM	REMERR			;[47]INDICATE NOT A REMOTE ERROR MSG
SHWM1A:	MOVE	T1,.OARGC(MO)		;[47]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
SHWM3A:	LOAD	S2,ARG.HD(T2),AR.LEN	;[46]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
	SKIPE	REMERR			;[47]A REMOTE ERROR MESSAGE?
	$TEXT	(LOGRTN,<>)		;[47]YES, ADD A CR-LF
	$RETT				;GOOD RETURN..
SHWM.4:	CAIE	S1,.CMTXT		;WAS IT JUST TEXT
	JRST	SHWM.5			;[46]CHECK FOR REMOTE BLOCK
	MOVEI	S1,ARG.DA(T2)		;ADDRESS OF TEXT
	JRST	SHWM.3			;OUTPUT THE TEXT
SHWM.5:	CAIN	S1,.ORRFG		;[46]REMOTE FLAG WORDS BLOCK?
	JRST	SHWM3A			;[46]YES, IGNORE THIS BLOCK	
	$STOP(IDM,<Invalid Display Message Type ^D/S1/>) ;[46] 
SUBTTL	L$ERR	Log a command error message


L$ERR:: $CALL	LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
L$ERR1:	MOVE	S1,[SIXBIT/OPRERR/]	;[51]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
	SKIPE	G$NERR##		;[42]A NEBULA RELATED ERROR?
	$RET				;[42]YES, RETURN NOW
	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)/-->)
	$RETT				;GOOD RETURN..
ERR.2:	$TEXT	(LOGRTN,<^I/LOGHDR/^I/(S2)/	--^I/@TXTTBL(S1)/-->)
	$RETT				;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)/>)
	$RETT				;GOOD RETURN..
	SUBTTL	L$NERR - Log a NEBULA related command error message

L$NERR::$CALL	LOGCHK			;[42]CHECK THE LOG STATUS
	JUMPF	.RETT			;[42]IGNORE ANY ERRORS
	$CALL	L$ERR1			;[51]PICK UP HEADER INFORMATION
	LOAD	S2,.OHDRS(MO),AR.LEN	;[51]PICK UP DISPLAY BLOCK LENGTH
	ADDI	S2,.OHDRS(MO)		;[51]POINT TO THE NEXT DISPLAY BLOCK
	ADDI	S2,2			;[42]POINT PASS HEADER AND UDT WORDS
	$TEXT	(LOGRTN,<^I/LOGHDR/ ^I/L$NE.1/ --^T/0(S2)/-->) ;[51]
	$RETT				;[42]RETURN TO THE CALLER

L$NE.1:	ITEXT	(<(In behalf of node ^N/.OHDRS+ARG.DA(MO)/)>) ;[51] 

SUBTTL	L$RERR	Log a command error message from a remote ORION

L$RERR:: $CALL	LOGCHK			;[45]CHECK THE LOG STATUS
	JUMPF	.RETT			;[45]IGNORE ANY ERRORS
	$TEXT	(LOGRTN,<^C/G$NOW/ OPRREM ^A>) ;[45]
	SETOM	REMERR			;[47]INDICATE A REMOTE ERROR
	PJRST	SHWM1A			;[47]GO FINISH LOGGING THE MESSAGE
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>)
	$RETT				;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>)
	$RETT				;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
	$RETT				;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$NWTO - Log a REMOTE WTO message

L$NWTO::$CALL	LOGCHK			;[42]CHECK THE LOG STATUS
	JUMPF	.RETT			;[42]IGNORE THE ERRORS
	MOVE	S1,[SIXBIT/OPRWTO/]	;[42]WTO TYPE MESSAGE
	MOVEM	S1,LOGIDN		;[42]SAVE LINE ID
	PJRST	REMLOG			;[42]GO FINISH LOGGING THE MESSAGE
	SUBTTL	L$LWTO - Log locally a WTO message that originated remotely

L$LWTO::$CALL	LOGCHK			;[42]CHECK THE LOG STATUS
	JUMPF	.RETT			;[42]IGNORE ANY ERRORS
	MOVE	S1,[SIXBIT/OPRWTO/]	;[42]PICK UP THE LOG TYPE
	MOVEM	S1,LOGIDN		;[42]SAVE LINE ID
	PJRST	L$LA.1			;[42]LOG THE MESSAGE
SUBTTL	L$RACK	Log a REMOTE ACK message 

L$RACK::$CALL	LOGCHK			;[42]CHECK THE LOG STATUS
	JUMPF	.RETT			;[42]IGNORE ANY ERRORS
	MOVE	S1,[SIXBIT/OPRACK/]	;[42]WTO TYPE MESSAGE
	MOVEM	S1,LOGIDN		;[42]SAVE LINE ID
REMLOG:	LOAD	S1,G$JOB		;[42]GET JOB NUMBER
	$CALL	GETJBT##		;[42]GET THE JOB DATA
	$TEXT	(LOGRTN,<^I/LOGHDR/ -- Request originated from node ^N/.OHDRS+ARG.DA(MO)/ --^M^J	^A>)
	LOAD	S1,.OHDRS+ARG.HD(MO),MS.CNT ;[42]PICK UP THE BLOCK'S LENGTH
	ADDI	S1,.OHDRS(MO)		;[42]ADDRESS OF THE SECOND BLOCK
	$TEXT	(LOGRTN,<^T/ARG.DA+1(S1)/^A>) ;[45]PICK UP ITS TEXT
	$RETT				;[42]RETURN THE CALLER
	SUBTTL	L$LACK - Log an ACK message that came from a remote node

L$LACK::$CALL	LOGCHK			;[42]CHECK THE LOG STATUS
	JUMPF	.RETT			;[42]IGNORE ANY ERRORS
	MOVE	S1,[SIXBIT/OPRACK/]	;[42]PICK UP HEADER TYPE
	MOVEM	S1,LOGIDN		;[42]SAVE FOR OUTPUT
L$LA.1:	LOAD	S1,G$JOB		;[42]PICK UP THE JOB NUMBER
	$CALL	GETJBT##		;[42]PICK UP HEADER INFORMATION
	$TEXT	(LOGRTN,<^I/LOGHDR/ ^I/L$LA.2/ ^I/L$LA.3/ ^A>) ;[42]

	MOVE	T1,.OARGC(MO)		;[45]PICK UP THE ARGUMENT COUNT
	SOS	T1			;[45]DECREMENT THE ARGUMENT COUNT
	LOAD	T2,.OHDRS+ARG.HD(MO),AR.LEN ;[42]PICK UP DISPLAY BLK LENGTH
	ADDI	T2,.OHDRS(MO)		;[42]POINT TO 2ND DISPLAY BLOCK
	PJRST	SHWM.2			;[42]FINISH LOGGING THE MESSAGE

L$LA.2:	ITEXT	(< ^T/ARG.DA+1+.OHDRS(MO)/>)           ;[42]
L$LA.3: ITEXT	(<processed at ^C/ARG.DA+.OHDRS(MO)/>) ;[42]
	SUBTTL	L$NEB - Log a NEBULA message

;L$NEB is called to log the receipt of a message that involves NEBULA.
;
;Call is: S1/Message code address
;         MI/Message address

L$NEB::	$CALL	LOGCHK			;[42]CHECK THE LOG STATUS
	JUMPF	.RETT			;[42]IGNORE THE ERRORS
	$TEXT	(LOGRTN,<^C/G$NOW/ NEBMSG ^A>)
	
	MOVEI	S2,NEBSTR		;[42]PICK UP THE NEBULA TEXT TABLE
	$CALL	TABSRC			;[42]PICK UP THE TEXT STRING
	JUMPF	L$NEB0			;[43]IF CAN'T FIND, THEN UNKNOWN
	PUSH	P,S2			;[43]SAVE THE STRING ADDRESS
	MOVE	S1,MI			;[43]PICK UP THE MESSAGE ADDRESS
	MOVEI	S2,.NDENM		;[43]CHECK FOR THE NODE BLOCK
	$CALL	N$FBLK			;[43]FIND THE NODE ARGUMENT BLOCK
	POP	P,S2			;[43]RESTORE THE STRING ADDRESS
	JUMPF	L$NEB1			;[50]OUTPUT NOW IF NO NODE NAME BLOCK
	MOVE	S1,ARG.DA(S1)		;[43]PICK UP THE NODE NAME
	SKIPA				;[43]SKIP OVER UNKNOWN MSG TYPE
L$NEB0:	MOVEI	S2,[ITEXT(<Unknown message type involving NEBULA detected>)]
L$NEB1:	$TEXT	(LOGRTN,<^I/0(S2)/ >)	;[50]OUTPUT THE DISPLAY LINE
	$RETT				;[42]GO FINISH UP
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)/>)
	$RETT				;GOOD RETURN..

	END				;END OPRLOG