Google
 

Trailing-Edge - PDP-10 Archives - BB-D868C-BM - 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	8 Oct 79


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

	SEARCH	GLXMAC,ORNMAC,QSRMAC
	PROLOG(OPRLOG)
	ERRSET			;INITIALIZE ERROR TABLES
	EXTERNAL G$ARG1		;ARGUMENT 1
	EXTERNAL G$ARG2		;ARGUMENT 2
	EXTERNAL G$ARG3		;ARGUMENT 3
	EXTERNAL .JBVER		;VERSION LOCATION INFO

	LOGEDT==:13		;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
\


	EXTERNAL GOODMS			;GOOD MESSAGE COUNT
	EXTERNAL G$NOW			;TIME OF DAY FIELD
	EXTERNAL JOBTXT			;JOB TEXT HEADER
	EXTERNAL GETJOB			;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. Murray Berkowitz        6 Apr 79..........................   1
;    2. Table of Contents.........................................   3
;    3. REQUIRED DATA FOR LOGGING.................................   3
;    4. L$INIT  --      INIT OPRLOG ROUTINE.......................   4
;    5. L$OPNL  --      ORION LOG FILE OPEN ROUTINE...............   5
;    6. L$REL   --      RELEASE THE LOG FILE......................   6
;    7. L$CLOS  --      CLOSE THE LOG FILE ROUTINE................   7
;    8. L$EXIT  --      STANDARD EXIT FOR ALL LOG FUNCTIONS.......   7
;    9. LOGCHK  --      CHECK THE LOG STATUS......................   8
;   10. L$CMD   --      LOG AN OPERATOR COMMAND...................   9
;   11. L$AOPR  --      ADD AN OPR FOR MESSAGES...................  10
;   12. L$DOPR  --      DELETE OPR FROM DATA BASE.................  11
;   13. L$NTFY  --      LOG THE NOTIFY MESSAGE....................  12
;   14. L$SHWA  --      SHOW MESSAGE ACK ROUTINE..................  13
;   15. L$SHWM  --      SHOW MESSAGE DISPLAY......................  14
;   16. L$ERR   --      LOG COMMAND ERROR MESSAGE.................  15
;   17. L$KMJB  --      KILL MESSAGE FOR A JOB BY SYSTEM ON LOGOUT  15
;   18. L$WTO   --      LOG THE WTO MESSAGE.......................  16
;   19. L$WTOR  --      LOG THE WTO MESSAGE.......................  16
;   20. L$ACK   --      LOG THE ACK MESSAGE.......................  16
;   21. L$NACK  --      LOG A NULL ACK MESSAGE....................  16
;   22. L$LOG   --      LOG THE LOG MESSAGE.......................  17
;   23. LOGRTN  --      Output Routine for ORION Log File.........  18
;   24. L$GSYS  --      GET SYSTEM NAME FOR LOG...................  19
;   25. L$SETF  --      LOG SETUP FAILURE REASONS IF PRESENT......  20
	SUBTTL	REQUIRED DATA FOR LOGGING

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

LOGSNM:	BLOCK	SYSNSZ			;SAVE 10 WORDS FOR SYSTEM NAME
LOGIDN:	BLOCK	1			;SAVE LOG LINE IDENT
LOGOPN:: BLOCK	1			;LOG FILE OPEN FLAG (-1 OPEN)
LOGINT:: EXP	O.LENA			;ENABLE/DISABEL LOGGING VALUE
LOGIFN:	BLOCK	1			;LOG FILE IFN
LOGFD:: EXP	LOGFD1			;ADDRESS OF THE FD
LOGFOB:	$BUILD	FOB.MZ		;SIZE OF THE FILE OPEN BLOCK
	$SET(FOB.FD,,LOGFD1)		;ADDRESS OF THE FD
	$SET(FOB.CW,FB.BSZ,7)		;BYTE SIZE OF 7
	$EOB
LOGMOR:	BLOCK	1			;MORE TEXT COMING 

	EXTERNAL NULTXT

IFN	FTJSYS,<

	DEFINE	X(A),<
	ASCIZ/PS:<SPOOL>'A'.001/
	>
LOGFD1:	LFD1SZ,,0
LOGNAM:	O$LOGN				;GENERATE LOG NAME
LFD1SZ==.-LOGFD1			;SIZE OF THE FD

	DEFINE	X(A),<
	ASCIZ/PS:<SPOOL>'A'.002/
	>

LOGFD2:	LFD2SZ,,0
LOGNM2:	O$LOGN				;GENERATE LOG NAME
LFD2SZ==.-LOGFD2			;SIZE OF THE FD

DEBFDB:	DEBFDS,,0
	ASCIZ/DSK:ORION-TEST.LOG/
DEBFDS==.-DEBFDB
>;END FTJSYS

IFN	FTUUOS,<
	DEFINE	X(A),<	SIXBIT/A/	>;END X

LOGFD1:	$BUILD	FDMSIZ			;SIZE OF THE FD
	$SET(.FDLEN,FD.LEN,FDMSIZ)	;SIZE OF THE BLOCK
	$SET(.FDSTR,,FSSSTR)		;STRUCTURE NAME
	$SET(.FDNAM,,O$LOGN)		;LOG NAME
	$SET(.FDEXT,,<SIXBIT/001/>)	;EXTENSION
	$EOB				;END OF BLOCK(PPN ADDED AT RUN TIME)

LOGFD2:	$BUILD	FDMSIZ			;SIZE OF THE FD
	$SET(.FDLEN,FD.LEN,FDMSIZ)	;SIZE OF THE BLOCK
	$SET(.FDSTR,,FSSSTR)		;STRUCTURE NAME
	$SET(.FDNAM,,O$LOGN)		;LOG NAME
	$SET(.FDEXT,,<SIXBIT/002/>)	;EXTENSION
	$EOB				;END OF BLOCK(PPN ADDED AT RUN TIME)

DEBFDB:	$BUILD	FDMSIZ			;SIZE OF THE FD
	$SET(.FDLEN,FD.LEN,FDMSIZ)	;SIZE OF THE BLOCK
	$SET(.FDSTR,,FSSSTR)		;STRUCTURE NAME
	$SET(.FDNAM,,<O$LOGN>)		;LOG NAME
	$SET(.FDEXT,,<SIXBIT/001/>)	;EXTENSION
	$EOB				;END OF BLOCK(PPN ADDED AT RUN TIME)

>;END FTUUOS
FRBBLK:	$BUILD	FRB.MZ			;MINIMUM SIZE RENAME BLOCK
	$SET(FRB.SF,,LOGFD1)		;FD1
	$SET(FRB.DF,,LOGFD2)		;FD2
	$EOB				;END OF THE BLOCK
	SUBTTL	L$INIT	--	INIT OPRLOG ROUTINE

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


IFN	FTUUOS,<
L$INIT:: SETZM	LOGOPN			;CLEAR LOG FILE OPEN FLAG
	MOVX	S1,%LDQUE		;GET THE QUEUE AREA
	GETTAB	S1,			;GET THE VALUE
	  MOVE	S1,[3,,3]		;DEFAULT TO 3,,3
	SKIPN	DEBUGW			;DEBUGGING
	  JRST	INIT.1			;NO CONTINUE ON
	SETOM	S1			;GET CURRENT PPN
	GETPPN	S1,			;GET CURRENT USER
	  JFCL				;BETTER SUCCEED
	MOVEM	S1,DEBFDB+.FDPPN	;SAVE THE PPN IN DEBUG FD
	MOVEI	S1,DEBFDB		;ADDRESS OF DEBUG FD
	MOVEM	S1,LOGFD		;SAVE IN LOGFD
	MOVEM	S1,LOGFOB+FOB.FD	;SAVE IN FOB
	$RETT
INIT.1:	MOVEM	S1,LOGFD1+.FDPPN	;SAVE THE PPN
	MOVEM	S1,LOGFD2+.FDPPN	;SAVE IN RENAME FD ALSO
>;END FTUUOS

IFN	FTJSYS,<
L$INIT:: SETZM	LOGOPN			;CLEAR LOG FILE OPEN FLAG
	SKIPN	DEBUGW			;DEBUGGING
	JRST	INIT.2			;DO THE RENAME
	MOVEI	S1,DEBFDB		;ADDRESS IF THE FD
	MOVEM	S1,LOGFD		;SAVE IN LOGFD
	MOVEM	S1,LOGFOB+FOB.FD	;SAVE IN FOB
	$RETT				;RETURN
>;END FTJSYS
INIT.2:	MOVEI	S1,FRB.MZ		;SIZE OF THE FILE RENAME BLOCK
	MOVEI	S2,FRBBLK		;ADDRESS OF THE BLOCK
	PUSHJ	P,F%REN			;ATTEMPT TO DO RENAME
	JUMPT	.POPJ			;O.K..RETURN
	$RETT				;IGNORE RENAME ERROR
	SUBTTL	L$OPNL	--	ORION LOG FILE OPEN ROUTINE

	;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
	PUSHJ	P,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
	PUSHJ	P,L$GSYS		;GET SYSTEM NAME
	$TEXT	(LOGRTN,<
^L	^H/G$NOW/ ORION Version ^V/.JBVER/ Beginning Log File
		IN  ^F/@LOGFD/ for SYSTEM
		^T/LOGSNM/
>)
	PJRST	L$EXIT			;EXIT AND RETURN
	SUBTTL	L$ABORT	--	ABORT LOG FILE WRITING

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


L$ABORT: PUSHJ	P,.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
	PUSHJ	P,E$LFE			;LOG FILE ERRORS
	PUSHJ	P,ERRALL##		;GENERATE ERROR AND RETURN
	SKIPN	P1			;WAS LOG FILE OPEN
	$RETF				;RETURN FALSE
	MOVE	S1,LOGIFN		;GET THE IFN
	PUSHJ	P,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 LOG FILE

	;THIS ROUTINE WILL CLOSE THE LOG 

L$REL:: PUSHJ	P,LOGCHK		;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE ERRORS
	MOVE	S1,LOGIFN		;GET THE LOG FILE IFN
	PUSHJ	P,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 LOG FILE ROUTINE

	;THIS ROUTINE WILL CHECKPOINT THE LOG FILE FOR NOW

L$CLOS:: PUSHJ	P,RELPAG##		;RETURN MESSAGE PAGE
	SKIPN	LOGINT			;LOGGING ENABLED??
	PJRST	E$LNI##			;LOGGING NOT ENABLED
	SKIPN	LOGOPN			;IS LOG FILE OPEN
	$RETT				;IGNORE IT
L$CHKP:: PUSHJ	P,LOGCHK		;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
	MOVE	S1,LOGIFN		;GET THE IFN
	PUSHJ	P,F%CHKP		;CHECKPOINT THE FILE
	JUMPT	.POPJ			;O.K...RETURN
	PUSHJ	P,L$ABORT		;ABORT LOG FILE
	$RETT				;RETURN O.K.


	SUBTTL	L$EXIT	--	STANDARD EXIT FOR ALL LOG FUNCTIONS

L$EXIT:	SKIPE	G$CHKP##		;WAS IT SETUP
	$RETT				;YES..JUST RETURN
	MOVEI	S1,%CHKTM*60*3		;GET INTERVAL
	ADD	S1,G$NOW##		;GET NEXT TIME
	MOVEM	S1,G$CHKP##		;SAVE THE TIME
	$RETT				;RETURN TRUE
	SUBTTL	LOGCHK	--	CHECK THE LOG 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:: PUSHJ	P,LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE ERRORS
	LOAD	S1,G$PRVS##,MD.PJB	;GET JOB NUMBER
	PUSHJ	P,GETJOB##		;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/ (PID=^O/G$SND/) Node ^W/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	--	ADD AN OPR FOR MESSAGES

	;THIS ROUTINE WILL LOG THE SIGNON OF AN OPR

L$AOPR:: PUSHJ	P,LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
	LOAD	S1,G$PRVS,MD.PJB	;GET JOB NUMBER
	PUSHJ	P,GETJOB		;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 ^W/NOD.NM(S2)/>)
	PJRST	L$EXIT			;GOOD RETURN..
	SUBTTL	L$DOPR	--	DELETE OPR FROM DATA BASE

	;THIS ROUTINE WILL LOG THE DELETION OF AN OPR

L$DOPR:: PUSHJ	P,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 ^W/NOD.NM(S2)/ (PID=^O/OPR.PD(S1)/)>)
	SUBTTL	L$NTFY	--	LOG THE NOTIFY MESSAGE

	;THIS ROUTINE WILL LOG THE NOTIFY MESSAGE

L$NTFY:: PUSHJ	P,LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
	MOVE	S1,[SIXBIT/OPRNFY/]	;NOTIFY MESSAGE
	MOVEM	S1,LOGIDN		;SAVE IDENTIFIER
	LOAD	S1,G$PRVS##,MD.PJB	;GET JOB NUMBER
	PUSHJ	P,GETJOB		;GET SENDERS INFO
	$TEXT	(LOGRTN,<^I/LOGHDR/^A>)	;PUT OUT THE HEADER
	LOAD	S1,.OHDRS+JBI.JB(MI)	;GET JOB NUMBER OF SENDER
	PUSHJ	P,GETJOB		;GET JOB INFO
	$TEXT	(LOGRTN,<		FOR: ^I/@JOBTXT/
		^T/.OHDRS+JBI.SZ+ARG.DA(MI)/>)
	PJRST	L$EXIT			;CHECKPOINT AND RETURN
	SUBTTL	L$SHWA	--	SHOW MESSAGE ACK ROUTINE

	;THIS ROUTINE WILL LOG AN ACK FROM QUASAR

L$SHWA:: PUSHJ	P,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	--	SHOW MESSAGE DISPLAY

	;THIS ROUTINE WILL LOG AN OPR DISPLAY MESSAGE TO LOG

L$SHWM:: PUSHJ	P,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 COMMAND ERROR MESSAGE

;THIS ROUTINE WILL LOG ALL COMMAND ERROR MESSAGES FROM OPR COMMANDS

L$ERR:: PUSHJ	P,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$PRVS##,MD.PJB	;GET JOB NUMBER
	PUSHJ	P,GETJOB##		;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:: PUSHJ	P,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	--	KILL MESSAGE FOR A JOB BY SYSTEM ON LOGOUT

L$KMJB:: PUSHJ	P,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 THE WTO MESSAGE

	;THIS ROUTINE WILL OUTPUT THE WTO MESSAGE TO THE LOG

L$WTO:: PUSHJ	P,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$PRVS##,MD.PJB	;GET JOB NUMBER
	PUSHJ	P,GETJOB##		;GET THE JOB DATA
	$TEXT	(LOGRTN,<^I/LOGHDR/^T/ARG.DA+.OHDRS+1(MO)/^A>)
	PJRST	L$EXIT			;GOOD RETURN..




	SUBTTL	L$WTOR	--	LOG THE WTO MESSAGE

	;THIS ROUTINE WILL OUTPUT THE WTOR MESSAGE TO THE LOG

L$WTOR:: PUSHJ	P,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$PRVS##,MD.PJB	;GET JOB NUMBER
	PUSHJ	P,GETJOB##		;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 THE ACK MESSAGE

	;THIS ROUTINE WILL OUTPUT THE ACK MESSAGE TO THE LOG

L$ACK:: PUSHJ	P,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:: PUSHJ	P,LOGCHK			;CHECK THE LOG STATUS
	JUMPF	.RETT			;IGNORE THE ERRORS
	LOAD	S1,G$PRVS,MD.PJB	;GET JOB NUMBER
	PUSHJ	P,GETJOB##		;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 THE LOG MESSAGE

	;THIS ROUTINE WILL OUTPUT THE LOG MESSAGE TO THE LOG

L$LOG:: PUSHJ	P,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	--	Output Routine for ORION Log File

	;THIS ROUTINE IS CALLED WITH S1 CONTAINING THE CHARACTER TO 
	;BE OUTPUT

LOGRTN:	MOVE	S2,S1			;PUT CHARACTER IN S2
	MOVE	S1,LOGIFN		;GET THE LOG FILE IFN
	PUSHJ	P,F%OBYT		;OUTPUT THE BYTE
	JUMPT	.POPJ			;RETURN IF O.K.
	  PJRST	L$ABORT			;ABORT LOG FILE
	SUBTTL	L$GSYS	--	GET SYSTEM NAME FOR LOG

IFN FTUUOS,<

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
	$RETT				;RETURN TRUE
>  ;END OF IFN FTUUOS

IFN FTJSYS,<

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
	$RETT				;RETURN TRUE
>;END FTJSYS
	SUBTTL	L$SETF	--	LOG SETUP FAILURE REASONS IF PRESENT


	;THIS ROUTINE WILL LOG A SETUP FAILURE REASON IF SUPPLIED BY OPR

L$SETF:: PUSHJ	P,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