Google
 

Trailing-Edge - PDP-10 Archives - bb-d868b-bm_tops20_v3a_2020_dist - 3a-sources/acctpr.mac
There are 3 other files named acctpr.mac in the archive. Click here to see a list.
;<3-UTILITIES>ACCTPR.MAC.7,  8-Nov-77 10:43:16, EDIT BY KIRSCHEN
;<3-UTILITIES>ACCTPR.MAC.6,  8-Nov-77 10:37:34, EDIT BY KIRSCHEN
;MORE COPYRIGHT UPDATING...
;<3-UTILITIES>ACCTPR.MAC.5, 26-Oct-77 10:56:10, EDIT BY KIRSCHEN
;UPDATE COPYRIGHT FOR RELEASE 3
;<3-UTILITIES>ACCTPR.MAC.4, 29-Sep-77 20:59:25, EDIT BY OSMAN
;USE CLZFF INSTEAD OF RLJFN SO THAT OTHER PROCESS'S JFNS DON'T GET FLUSHED
;<3-UTILITIES>ACCTPR.MAC.3, 25-Aug-77 11:24:01, EDIT BY KIRSCHEN
;FIX VERSION NUMBERS FOR RELEASE 3
;<3-UTILITIES>ACCTPR.MAC.2, 12-Aug-77 15:29:50, Edit by HESS
;TCO 1850 - FIX DISK RECORD CLOBBERAGE FOR ALPHANUMERIC ACCOUNTS
;<2-UTILITIES>ACCTPR.MAC.8,  3-Feb-77 11:52:54, EDIT BY KIRSCHEN
;TCO 1730 - MAKE ACCTPR HANDLE PRE-RELEASE-2 FACT ENTRIES PROPERLY
;<2-UTILITIES>ACCTPR.MAC.7, 27-Dec-76 17:05:03, EDIT BY HURLEY
;<2-UTILITIES>ACCTPR.MAC.6, 23-Sep-76 14:26:45, Edit by HESS
;TCO 1537 - HANDLE NEW DISK TYPE FACT ENTRIES & CHANGE OUTPUT FORMAT
;<2-UTILITIES>ACCTPR.MAC.2, 10-Sep-76 16:01:35, EDIT BY CROSSLAND
;TCO # 1525  PAD ALPANUMERIC ACCOUNTS TO 39 CHARACTER, REMOVE EXTRA PADDING
;FROM DISK STATISTICS
;TCO # 1524 EDUCATED PROGRAM ABOUT NUMERIC ACCOUNT DESIGNATORS.
;<1A-UTILITIES>ACCTPR.MAC.21,  6-MAY-76 10:49:49, EDIT BY HURLEY
;<1A-UTILITIES>ACCTPR.MAC.15,  8-APR-76 11:05:29, EDIT BY HURLEY
;TCO 1244 - ADD .DIRECT .XTABM FOR MACRO 50 ASSEMBLIES
;<V-SOURCES>ACCTPR.MAC.14, 23-DEC-75 12:11:37, EDIT BY LEWINE

TITLE ACCTPR - PROGRAM TO TRANSLATE BINARY ACCOUNTING FILES TO ASCII
SUBTTL		D. KIRSCHEN		11-20-75



;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1976, 1977, 1978 BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

	SEARCH MONSYM, MACSYM
	.REQUIRE SYS:MACREL
	SALL
	IFNDEF .PSECT,<
	.DIRECT .XTABM>

; ACCUMULATOR DEFINITIONS

	T1=1		;GENERAL PURPOSE
	T2=2		;GENERAL PURPOSE
	T3=3		;GENERAL PURPOSE
	T4=4		;GENERAL PURPOSE
	P1=5		;PRESERVED
	P2=6		;PRESERVED
	P3=7		;PRESERVED
	P4=10		;PRESERVED
	CX=16		;RESERVED FOR SUPPORT CODE
	P=17		;PUSH-DOWN STACK

; VERSION NUMBERS

	VMAJOR==3		;MAJOR VERSION
	VMINOR==0		;MINOR VERSION
	VWHO==0			;WHO LAST EDITED (0= DEC DEVELOPMENT)
	VEDIT==31		;EDIT NUMBER

VACCTP== <VWHO>B2+<VMAJOR>B11+<VMINOR>B17+VEDIT

; SYMBOL DEFINITIONS

PDLEN==50		;LENGTH OF PUSH-DOWN STACK
NCHPW==5		;NUMBER OF ASCII CHARACTERS PER WORD
CMDMAX==100		;MAX SIZE OF COMMAND TABLE
NAMSIZ==21		;SIZE OF NAME BUFFER
ENTMSZ==40		;MAX SIZE OF FACT ENTRY BLOCK
BUFSIZ==200		;SIZE OF INPUT TEXT BUFFER
ATMSIZ==BUFSIZ		;SIZE OF ATOM BUFFER FOR COMND JSYS
GJFSIZ==.GJRTY+2	;SIZE OF GTJFN BLOCK USED BY COMND JSYS
NUMFLG==<FLD(^D12,NO%COL)+FLD(^D10,NO%RDX)+NO%LFL+NO%ZRO>
SUBTTL	OUTPUT RECORD FIELD SIZE DEFINITIONS

.FSCOD==3		;ENTRY CODE TYPE
.FSJOB==3		;JOB NUMBER
.FSLIN==4		;LINE NUMBER
.FSNAM==^D81		;NAME
.FSMON==2		;MONTH
.FSDAY==2		;DAY
.FSYR==2		;YEAR
.FSTIM==4		;TIME
.FSRUN==^D12		;RUNTIME
.FSATP==1		;ACCOUNT TYPE (A=ALPHANUMERIC, N=NUMERIC)
.FSACT==^D39		;ACCOUNT
.FSCON==^D12		;CONSOLE TIME
.FSFIL==^D12		;NUMBER OF FILE PAGES
.FSLPT==^D12		;NUMBER OF PRINTER PAGES
.FSCDR==^D12		;NUMBER OF CARDS READ
.FSDEV==6		;SPOOLED DEVICE
SUBTTL	FACT FILE ENTRY DEFINITIONS

; OFFSETS INTO FACT ENTRIES

.EFRUN==3		;RUN TIME
.EFFIL==3		;NUMBER OF FILE PAGES
.EFCON==4		;CONSOLE TIME
.EFDEV==4		;DEVICE DESIGNATOR IN SPOOLER ENTRIES
.EFQUA==5		;QUANTITY OF OUTPUT IN SPOOLER ENTRIES

; FIELD DEFINITIONS FOR STANDARD FIELDS IN THE ENTRIES

MSKSTR (ENTCOD,FCTENT+.EFHDR,EF%COD)	;ENTRY TYPE CODE
MSKSTR (ENTJOB,FCTENT+.EFHDR,EF%JOB)	;JOB NUMBER
MSKSTR (ENTLIN,FCTENT+.EFHDR,EF%LIN)	;LINE NUMBER
MSKSTR (ENTSIZ,FCTENT+.EFHDR,EF%SIZ)	;SIZE OF ENTRY
DEFSTR (ENTUSR,FCTENT+.EFUSR,35,36)	;USER NAME
DEFSTR (ENTTAD,FCTENT+.EFTAD,35,36)	;TIME AND DATE
DEFSTR (ENTRUN,FCTENT+.EFRUN,35,36)	;RUN TIME
DEFSTR (ENTFIL,FCTENT+.EFFIL,35,36)	;NUMBER OF FILE PAGES USED
DEFSTR (ENTCTM,FCTENT+.EFCON,35,36)	;CONSOLE TIME
DEFSTR (ENTDEV,FCTENT+.EFDEV,35,36)	;DEVICE IN SPOOLER ENTRIES
DEFSTR (ENTQUA,FCTENT+.EFQUA,35,36)	;QUANTITY OF OUTPUT IN SPOOLER ENTRIES

; INDEX IN FACT ENTRIES TO ACCOUNT TYPE WORD

.AWLGI==4		;LOGIN
.AWCAC==4		;CHANGE ACCOUNT
.AWDSK==4		;DISK UTILIZATION
.AWLPT==7		;LINE PRINTER
.AWCDR==7		;CARD READER
SUBTTL	MACRO DEFINITIONS

; FUNCTION DESCRIPTOR BLOCK FOR COMND JSYS

DEFINE CMFDB (TYPE,FLAGS,DATA,HELP,DEFLT,LST)
<	..XX== < FLD(TYPE,CM%FNC) + FLAGS + LST >
  IFNB <HELP>,< ..XX== ..XX+CM%HPP >
  IFNB <DEFLT>,< ..XX== ..XX+CM%DPP >
	..XX
  IFNB <DATA>,<DATA>
  IFB <DATA>,<0>
  IFNB <HELP>, <POINT 7,[ASCIZ\HELP\] >
  IFB <HELP>,  <0>
  IFNB <DEFLT>, <POINT 7,DEFLT >
  IFB <DEFLT>, <0>
>

DEFINE TXT(TEXT) <POINT 7,[ASCIZ\TEXT\]>
SUBTTL	MAIN ENTRY POINT AND INITIALIZATION

START:	RESET			;RESET THE UNIVERSE
	MOVE P,[IOWD PDLEN,PDL]	;SET UP THE PUSH-DOWN STACK
	MOVX T1,.FHSLF		;GET OUR FORK HANDLE
	MOVE T2,[LEVTAB,,CHNTAB] ;GET INTERRUPT TABLE ADDRESSES
	SIR			;SET INTERRUPT TABLE ADDRESSES
	MOVX T1,.FHSLF		;GET OUR FORK HANDLE
	MOVX T2,1B<.ICEOF>	;GET END-OF-FILE-CHANNEL BIT
	AIC			;ACTIVATE INTERRUPT CHANNEL FOR EOF
	MOVX T1,.FHSLF		;GET OUR FORK HANDLE
	EIR			;ENABLE INTERUUPTS FOR THIS PROCESS

; SET UP COMMAND STATE BLOCK FOR COMND JSYS

	HRROI T1,PROMPT		;GET POINTER TO PROMPT STRING
	MOVEM T1,CMDBLK+.CMRTY	;PUT RE-TYPE PROMPT POINTER IN STATE BLOCK
	HRROI T1,BUFFER		;GET POINTER TO INPUT TEXT BUFFER
	MOVEM T1,CMDBLK+.CMPTR	;SAVE POINTER TO COMMAND STRING
	MOVEM T1,CMDBLK+.CMBFP	;SAVE POINTER TO START-OF-BUFFER
	MOVE T1,[.PRIIN,,.PRIOU] ;GET PRIMARY INPUT,, OUTPUT JFN'S
	MOVEM T1,CMDBLK+.CMIOJ	;SAVE PRIMARY JFN'S
	MOVEI T1,PARSE1		;GET RE-PARSE ADDRESS
	MOVEM T1,CMDBLK+.CMFLG	;SAVE RE-PARSE ADDRESS
	SETZM CMDBLK+.CMINC	;INITIALIZE # OF CHARACTERS AFTER POINTER
	MOVEI T1,BUFSIZ*NCHPW	;GET # OF CHARACTERS IN BUFFER AREA
	MOVEM T1,CMDBLK+.CMCNT	;SAVE INITIAL # OF FREE CHARACTER POSITIONS
	HRROI T1,ATMBFR		;GET POINTER TO ATOM BUFFER
	MOVEM T1,CMDBLK+.CMABP	;SAVE POINTER TO LAST ATOM INPUT
	MOVEI T1,ATMSIZ*NCHPW	;GET # OF CHARACTERS IN ATOM BUFFER
	MOVEM T1,CMDBLK+.CMABC	;SAVE COUNT OF SPACE LEFT IN ATOM BUFFER
SUBTTL	COMMAND PARSER AND DISPATCH

PARSE:	CALL TSTCOL		;GO OUTPUT CRLF IF NEEDED
	MOVEI T1,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI T2,[CMFDB (.CMINI)] ;GET FUNCTION DESCRIPTOR BLOCK
	COMND			;INITIALIZE COMMAND SCANNER JSYS

PARSE1:	MOVE T1,[CZ%NCL+.FHSLF]	;RELEASE ALL NON-OPEN JFNS IN OURSELF AND BELOW
	CLZFF
	MOVE T1,[GJFBLK,,GJFBLK+1] ;SET UP TO CLEAR GTJFN BLOCK
	SETZM GJFBLK		;CLEAR FIRST WORD OF BLOCK
	BLT T1,GJFBLK+GJFSIZ-1	;CLEAR GTJFN BLOCK

	MOVEI T1,GJFBLK		;GET ADDRESS OF GTJFN BLOCK
	MOVEM T1,CMDBLK+.CMGJB	;STORE POINTER TO GTJFN BLOCK
	MOVEI T1,CMDBLK		;GET POINTER TO COMMAND STATE BLOCK
	MOVEI T2,[CMFDB (.CMKEY,,CMDTAB)] ;GET FUNCTION BLOCK
	COMND			;DO INITIAL PARSE
	TXNN T1,CM%NOP		;VALID COMMAND ENTERED ?
	JRST PARSE5		;YES, GO DISPATCH TO PROCESSING ROUTINE
	CALL TSTCOL		;TEST COLUMN POSITION, NEW LINE IF NEEDED
	TMSG <? ACCTPR: No such ACCTPR command as ">
	MOVE T1,CMDBLK+.CMABP	;GET POINTER TO ATOM BUFFER
	PSOUT			;OUTPUT STRING ENTERED BY USER
	TMSG <"
>				;OUTPUT END-OF-MESSAGE
	JRST PARSE		;GO TRY TO GET A COMMAND AGAIN

PARSE5:	HRRZ T1,(T2)		;GET DISPATCH ADDRESS
	CALL (T1)		;PERFORM REQUESTED FUNCTION
	JRST PARSE		;GO PARSE NEXT COMMAND
SUBTTL	TRANSLATE COMMAND

.TRANS:	MOVEI T1,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI T2,[CMFDB (.CMNOI,,<TXT(FACT FILE)>)] ;GET NOISE PHRASE
	COMND			;PARSE NOISE PHRASE
	MOVE T1,[GJFBLK,,GJFBLK+1] ;SET UP TO CLEAR GTJFN BLOCK
	SETZM GJFBLK		;CLEAR FIRST WORD OF GTJFN BLOCK
	BLT T1,GJFBLK+GJFSIZ-1	;CLEAR GTJFN BLOCK
	HRROI T1,[ASCIZ/FACT/]	;GET DEFAULT NAME FOR INPUT FILE
	MOVEM T1,GJFBLK+.GJNAM	;SAVE DEFAULT FILE NAME FOR GTJFN
	HRROI T1,[ASCIZ/BIN/]	;GET DEFAULT EXTENSION
	MOVEM T1,GJFBLK+.GJEXT	;SAVE DEFAULT EXTENSION
	MOVX T1,GJ%OLD		;GET "OLD FILE ONLY" FLAG
	MOVM T1,GJFBLK+.GJGEN	;SAVE GTJFN FLAGS
	MOVEI T2,[CMFDB (.CMFIL)] ;GET OUTPUT FILE FUNCTION
	MOVEI T1,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	COMND			;PARSE OUTPUT FILE
	TXNN T1,CM%NOP		;PARSED FILENAME OK ?
	JRST TRAN10		;YES, GO ON AND SAVE JFN
	CALL TSTCOL		;NO, ISSUE CRLF IF NEEDED
	TMSG <? ACCTPR: Invalid file specification,
	>			;OUTPUT INITIAL PART OF MESSAGE
	callret typerr		;go type out error string

; HERE ON A VALID FILE SPEC

TRAN10:	MOVEM T2,INJFN		;SAVE INPUT FILE JFN
	MOVEI T1,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI T2,[CMFDB (.CMNOI,,<TXT(TO)>)] ;GET NOISE PHRASE
	COMND			;PARSE NOISE PHRASE
	MOVE T1,[GJFBLK,,GJFBLK+1] ;SET UP TO CLEAR GTJFN BLOCK
	SETZM GJFBLK		;CLEAR FIRST WORD OF GTJFN BLOCK
	BLT T1,GJFBLK+GJFSIZ-1	;CLEAR GTJFN BLOCK
	HRROI T1,[ASCIZ/FACT/]	;GET DEFAULT NAME FOR INPUT FILE
	MOVEM T1,GJFBLK+.GJNAM	;SAVE DEFAULT FILE NAME FOR GTJFN
	HRROI T1,[ASCIZ/TXT/]	;GET DEFAULT EXTENSION
	MOVEM T1,GJFBLK+.GJEXT	;SAVE DEFAULT EXTENSION
	MOVX T1,GJ%FOU		;GET FOR OUTPUT USE FLAG
	MOVM T1,GJFBLK+.GJGEN	;SAVE GTJFN FLAGS
	MOVEI T2,[CMFDB (.CMFIL)] ;GET OUTPUT FILE FUNCTION
	MOVEI T1,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	COMND			;PARSE OUTPUT FILE
	TXNN T1,CM%NOP		;PARSED FILENAME OK ?
	JRST TRAN20		;YES, GO GET CONFIRMATION
	CALL TSTCOL		;ISSUE CRLF IF NEEDED
	TMSG <? ACCTPR: Invalid file specification,
	>			;ISSUE INITIAL PART OF MESSAGE
	call typerr		;go type out error string
	MOVE T1,INJFN		;GET INPUT JFN
	RLJFN			;RELEASE INPUT JFN
	 JFCL			;IGNORE ERROR
	RET			;RETURN TO PARSER

; HERE TO GET CONFIRMATION OF COMMAND AND OPEN FILES

TRAN20:	MOVEM T2,OUTJFN		;SAVE OUTPUT FILE JFN
	MOVEI T1,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI T2,[CMFDB (.CMCFM)] ;GET CONFIRMATION
	COMND			;PARSE END-OF-COMMAND
	TXNE T1,CM%NOP		;END-OF-COMMAND PARSED OK ?
	CALLRET COMER1		;NO, GO ISSUE MESSAGE
	MOVE T1,INJFN		;GET INPUT FILE JFN
	MOVX T2,<FLD(^D36,OF%BSZ)+OF%RD> ;READ ACCESS
	OPENF			;OPEN BINARY INPUT FILE
	 JRST TRAN40		;ERROR ON OPEN
	MOVE T1,OUTJFN		;GET OUTPUT JFN
	MOVX T2,<FLD(7,OF%BSZ)+OF%WR> ;GET WRITE ACCESS
	OPENF			;OPEN OUTPUT FILE
	 JRST OUTP50		;ERROR, GO ISSUE MESSAGE
	SETZM HITAD		;INITIALIZE HIGHEST TIME AND DATE

; LOOP TO PROCESS ALL ENTRIES IN FACT FILE

TRAN30:	CALL GETENT		;GO READ AN ENTRY FROM INPUT FACT FILE
	MOVEM T1,P1		;SAVE INDEX INTO DISPATCH TABLE
	LOAD T1,ENTTAD		;GET TIME AND DATE FROM FACT ENTRY
	CAMLE T1,HITAD		;FOUND A NEW HIGHEST TIME AND DATE ?
	MOVEM T1,HITAD		;YES, STORE NEW HIGHEST TIME AND DATE
	CALL DOHDR1		;OUTPUT INITIAL HEADER INFORMATION
	MOVE T2,HITAD		;GET HIGHEST TIME AND DATE SEEN SO FAR
	LOAD T1,ENTSIZ		;GET SIZE OF FACT FILE ENTRY
	CAIGE T1,.EFTAD		;TIME AND DATE PRESENT ?
	STOR T2,ENTTAD		;NO, USE HIGHEST TIME AND DATE THUS FAR
	CALL DOHDR2		;OUTPUT DIRECTORY AND TIME AND DATE
	HRRZ T1,TYPTAB(P1)	;GET ROUTINE TO PROCESS THIS ENTRY
	CALL (T1)		;GO CALL PROCESSING ROUTINE
	JRST TRAN30		;GO DO NEXT ENTRY

; HERE ON ERROR ON INPUT FILE OPEN

TRAN40:	CALL TSTCOL		;ISSUE CRLF IF NEEDED
	TMSG <? ACCTPR: Could not open input file because:
>				;ISSUE ERROR MESSAGE
	call typerr		;go type out error string
	MOVE T1,INJFN		;GET INPUT FILE JFN
	RLJFN			;RELEASE THE JFN
	 JSERR			;UNEXPECTED ERROR
	JRST TRAN60		;GO RELEASE THE OUTPUT FILE JFN

; HERE ON ERROR ON OUTPUT FILE OPEN

OUTP50:	CALL TSTCOL		;ERROR, ISSUE CRLF IF NEEDED
	TMSG <? ACCTPR: Could not open output file because:
>				;ISSUE ERROR MESSAGE
	call typerr		;go type out error string
TRAN60:	MOVE T1,OUTJFN		;GET OUTPUT JFN
	RLJFN			;RELEASE THE JFN
	 JSERR			;UNEXPECTED ERROR
	RET			;RETURN
SUBTTL	HELP AND EXIT COMMANDS

.EXIT:	MOVEI T1,CMDBLK		;GET ADDRESS OF COMMAND BLOCK
	MOVEI T2,[CMFDB (.CMNOI,,<TXT(TO MONITOR)>)]
	COMND			;PARSE NOISE PHRASE
	MOVEI T2,[CMFDB (.CMCFM)] ;GET FUNCTION BLOCK FOR CONFIM
	COMND			;PARSE CONFIRMATION
	TXNE T1,CM%NOP		;VALID END-OF-COMMAND SEEN ?
	CALLRET COMER1		;NO, ISSUE ERROR MESSAGE AND RETURN
	SETOM T1		;INDICATE ALL FILES SHOULD BE CLOSED
	CLOSF			;CLOSE ALL OPEN FILES
	 JSERR			;UNEXPECTED ERROR
	HALTF			;RETURN TO MONITOR
	JRST START		;IF CONTINUE'D, START OVER


; HELP COMMAND

.HELP:	MOVEI T1,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI T2,[CMFDB (.CMCFM)] ;GET CONFIRM FUNCTION
	COMND			;PARSE END-OF-COMMAND
	TXNE T1,CM%NOP		;END-OF-COMMAND PARSED OK ?
	CALLRET COMER1		;NO, ISSUE ERROR MESSAGE
	HRROI T1,HLPMSG		;GET POINTER TO HELP TEXT
	PSOUT			;OUTPUT HELP TEXT
	RET			;RETURN TO COMMAND PARSER
SUBTTL	END-OF-FILE INTERRUPT HANDLER

EOFINT:	MOVE T1,INJFN		;GET INPUT FILE JFN
	CLOSF			;CLOSE THE INPUT FILE
	 JSERR			;UNEXPECTED ERROR
	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	CLOSF			;CLOSE THE OUTPUT FILE
	 JSERR			;UNEXPECTED ERROR
	MOVEI T1,START		;GET RETURN ADDRESS
	MOVEM T1,RETPC1		;STORE RETURN ADDRESS
	DEBRK			;DISMISS INTERRUPT
	0
SUBTTL	PROCESS LOGOUT ENTRIES

TRLGO:	MOVE T1,OUTJFN		;GET OUTPUT JFN
	LOAD T2,ENTRUN		;GET RUNTIME FROM ENTRY
	MOVX T3,NUMFLG		;GET FLAGS FOR NUMERIC FIELDS
	NOUT			;OUTPUT RUNTIME FROM ENTRY
	 JSERR			;UNEXPECTED ERROR
	HRROI T2,SPCBUF		;GET POINTER TO SPACES
	MOVNI T3,.FSATP+.FSACT	;GET NUMBER OF SPACES TO USE FOR PADDING
	SOUT			;OUTPUT FILLER
	LOAD T2,ENTCTM		;GET CONSOLE TIME FROM ENTRY
	MOVX T3,NUMFLG		;GET NUMERIC FIELD FLAGS
	NOUT			;OUTPUT CONSOLE TIME
	 JSERR			;UNEXPECTED ERROR
	HRROI T2,SPCBUF		;GET POINTER TO SPACES
	MOVNI T3,.FSFIL+.FSLPT+.FSCDR+.FSDEV
	SOUT			;OUTPUT FILLER TO END OF RECORD
	HRROI T2,EOR		;GET POINTER TO END-OF-RECORD
	SETZM T3		;TERMINATE ON NULL
	SOUT			;OUTPUT END-OF-RECORD
	RET			;RETURN
SUBTTL	PROCESS LOGIN ENTRIES

TRLGI:	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	HRROI T2,SPCBUF		;GET POINTER TO SPACES
	MOVNI T3,.FSRUN		;GET # OF COLUMNS TO PAD
	SOUT			;PAD RECORD
	MOVEI T1,.AWLGI		;GET INDEX TO ACCOUNT WORD IN LOGIN ENTRY
	CALL TSTACT		;GO TEST FOR A NUMERIC ACCOUNT
	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	MOVEI T2,"A"		;GET "ALPHANUMERIC ACCOUNT" INDICATOR
	SKIPL FCTENT+.AWLGI	;NUMERIC ACCOUNT ?
	MOVEI T2,"N"		;YES, GET "NUMERIC ACCOUNT" INDICATOR
	BOUT			;OUTPUT ACCOUNT TYPE

; OUTPUT ACCOUNT

	SKIPL FCTENT+.AWLGI	;NUMERIC ACCOUNT ?
	JRST TRLGI2		;YES, GO OUTPUT NUMERIC ACCOUNT
	HRROI T2,FCTENT+.AWLGI+1 ;GET POINTER TO ACCOUNT STRING
	MOVE T3,FCTENT+.AWLGI	;GET -<NUMBER OF CHARS> IN ACCOUNT STRING
	SOUT			;OUTPUT ACCOUNT STRING
	MOVN T3,FCTENT+.AWLGI	;GET NUMBER OF CHARACTERS IN ACCOUNT STRING
	SOS T3			;DO NOT COUNT FIRST NULL
	JRST TRLGI4		;GO PAD REMAINDER OF RECORD

; HERE TO OUTPUT NUMERIC ACCOUNT

TRLGI2:	HRROI T2,SPCBUF		;GET POINTER TO SPACE BUFFER
	MOVNI T3,^D27		;GET # OF SPACES TO OUTPUT
	SOUT			;OUTPUT FILLER
	MOVE T2,FCTENT+.AWLGI	;GET ACCOUNT TYPE WORD (NUMERIC ACCOUNT #)
	MOVX T3,<FLD(^D12,NO%COL)+FLD(^D10,NO%RDX)+NO%LFL>
	NOUT			;OUTPUT ACCOUNT NUMBER
	 JSERR			;UNEXPECTED ERROR
	MOVEI T3,.FSACT		;NUMBER OF CHARACTERS IN ACCOUNT STRING

; HERE TO OUTPUT FILLER FOR ACCOUNT STRING, FILLER TO END OF RECORD, AND
; END-OF-RECORD

TRLGI4:	MOVE T1,OUTJFN		;GET OUTPUT JFN
	HRROI T2,SPCBUF		;GET POINTER TO SPACES
	SUBI T3,.FSACT+.FSCON+.FSFIL+.FSLPT+.FSCDR+.FSDEV
	SOUT			;OUTPUT PADDING
	HRROI T2,EOR		;GET POINTER TO END OF RECORD
	SETZM T3		;TERMINATE ON NULL
	SOUT			;OUTPUT END-OF-RECORD
	RET			;RETURN
SUBTTL	PROCESS CHKPNT ENTRIES

TRCHK:	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	LOAD T2,ENTRUN		;GET RUNTIME FROM ENTRY
	MOVX T3,NUMFLG		;GET NUMERIC FIELD FLAGS
	NOUT			;OUTPUT RUNTIME
	 JSERR			;UNEXPECTED ERROR
	HRROI T2,SPCBUF		;GET POINTER TO SPACES FOR FILLER
	MOVNI T3,.FSATP+.FSACT+.FSCON+.FSFIL+.FSLPT+.FSCDR+.FSDEV
	SOUT			;OUTPUT TRAILING SPACES AS PADDING
	HRROI T2,EOR		;GET POINTER TO END-OF-RECORD
	SETZM T3		;TERMINATE ON NULL
	SOUT			;OUTPUT END-OF-RECORD
	RET			;RETURN
SUBTTL	PROCESS TIME SET ENTRIES

TRTIM:	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	HRROI T2,SPCBUF		;GET POINTER TO SPACES FOR FILLER
	MOVNI T3,.FSRUN+.FSATP+.FSACT+.FSCON+.FSFIL+.FSLPT+.FSCDR+.FSDEV
	SOUT			;OUTPUT PADDING
	HRROI T2,EOR		;GET POINTER TO END OF RECORD
	SOUT			;OUTPUT END OF RECORD
	RET			;RETURN
SUBTTL	PROCESS SYSTEM RESTART AND START-OF-DISK-STATISTICS ENTRIES

TRRES:
TRSDU:
	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	HRROI T2,SPCBUF		;GET POINTER TO SPACES FOR FILLER
	MOVNI T3,.FSRUN+.FSATP+.FSACT+.FSCON+.FSFIL+.FSLPT+.FSCDR+.FSDEV
	SOUT			;OUTPUT PADDING
	HRROI T2,EOR		;GET POINTER TO END OF RECORD
	SOUT			;OUTPUT END OF RECORD
	RET			;RETURN
SUBTTL	PROCESS ATTACH AND DETACH ENTRIES

TRDET:
TRATT:
	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	HRROI T2,SPCBUF		;GET POINTER TO SPACES FOR PADDING
	MOVNI T3,.FSRUN+.FSATP+.FSACT+.FSCON+.FSFIL+.FSLPT+.FSCDR+.FSDEV
	SOUT			;OUTPUT FILLER
	HRROI T2,EOR		;GET END-OF-RECORD TEXT
	SETZM T3		;TERMINATE ON NULL
	SOUT			;OUTPUT END-OF-RECORD
	RET			;RETURN
SUBTTL	PROCESS CHANGE ACCOUNT ENTRIES

TRCAC:	MOVE T1,OUTJFN		;GET OUTPUT JFN
	LOAD T2,ENTRUN		;GET RUNTIME FROM ENTRY
	MOVX T3,NUMFLG		;GET NUMERIC FIELD FLAGS
	NOUT			;OUTPUT RUNTIME
	 JSERR			;UNEXPECTED ERROR
	MOVEI T1,.AWCAC		;GET INDEX TO ACCOUNT WORD IN ENTRY
	CALL TSTACT		;GO TEST ACCOUNT TO SEE IF NUMERIC
	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	MOVEI T2,"A"		;GET "ALPHANUMERIC ACCOUNT" INDICATOR
	SKIPL FCTENT+.AWCAC	;NUMERIC ACCOUNT ?
	MOVEI T2,"N"		;YES, GET "NUMERIC ACCOUNT" INDICATOR
	BOUT			;OUTPUT ACCOUNT TYPE

; OUTPUT ACCOUNT

	SKIPL FCTENT+.AWCAC	;NUMERIC ACCOUNT ?
	JRST TRCAC2		;YES, GO OUTPUT NUMERIC ACCOUNT
	HRROI T2,FCTENT+.AWCAC+1 ;GET POINTER TO ACCOUNT STRING
	MOVE T3,FCTENT+.AWCAC	;GET -<NUMBER OF CHARS> IN ACCOUNT STRING
	SOUT			;OUTPUT ACCOUNT STRING
	MOVN T3,FCTENT+.AWLGI	;GET NUMBER OF CHARACTERS IN ACCOUNT STRING
	SOS T3			;DO NOT COUNT FIRST NULL
	JRST TRCAC4		;GO PAD REMAINDER OF RECORD

; HERE TO OUTPUT NUMERIC ACCOUNT

TRCAC2:	HRROI T2,SPCBUF		;GET POINTER TO SPACE BUFFER
	MOVNI T3,^D27		;GET # OF SPACES TO OUTPUT
	SOUT			;OUTPUT FILLER
	MOVE T2,FCTENT+.AWCAC	;GET ACCOUNT TYPE WORD (NUMERIC ACCOUNT #)
	MOVX T3,<FLD(^D12,NO%COL)+FLD(^D10,NO%RDX)+NO%LFL>
	NOUT			;OUTPUT ACCOUNT NUMBER
	 JSERR			;UNEXPECTED ERROR
	MOVEI T3,.FSACT		;NUMBER OF CHARACTERS IN ACCOUNT STRING

; HERE TO OUTPUT FILLER TO END OF RECORD, AND END-OF-RECORD

TRCAC4:	MOVE T1,OUTJFN		;GET OUTPUT JFN
	HRROI T2,SPCBUF		;GET POINTER TO SPACES
	SUBI T3,.FSACT+.FSCON+.FSFIL+.FSLPT+.FSCDR+.FSDEV
	SOUT			;OUTPUT PADDING
	HRROI T2,EOR		;GET POINTER TO END OF RECORD
	SETZM T3		;TERMINATE ON NULL
	SOUT			;OUTPUT END-OF-RECORD
	RET			;RETURN
SUBTTL	PROCESS DISK UTILIZATION ENTRIES

TRDSK:	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	MOVEI T2,0		;GET A ZERO
	MOVX T3,NUMFLG		;GET NUMERIC FIELD FLAGS
	NOUT			;OUTPUT 0'S FOR RUNTIME
	 JSERR			;UNEXPECTED ERROR
	MOVEI T1,.AWDSK		;GET INDEX TO ACCOUNT WORD IN ENTRY
	CALL TSTACT		;GO TEST ACCOUNT TO SEE IF NUMERIC
	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	MOVEI T2,"A"		;GET "ALPHANUMERIC ACCOUNT" INDICATOR
	SKIPL FCTENT+.AWDSK	;NUMERIC ACCOUNT ?
	MOVEI T2,"N"		;YES, GET "NUMERIC ACCOUNT" INDICATOR
	BOUT			;OUTPUT ACCOUNT TYPE

; OUTPUT ACCOUNT

	SKIPL FCTENT+.AWDSK	;NUMERIC ACCOUNT ?
	JRST TRDSK2		;YES, GO OUTPUT NUMERIC ACCOUNT
	HRROI T2,FCTENT+.AWDSK+1 ;GET POINTER TO ACCOUNT STRING
	MOVE T3,FCTENT+.AWDSK	;GET -<NUMBER OF CHARS> IN ACCOUNT STRING
	SOUT			;OUTPUT ACCOUNT STRING
	MOVN T3,FCTENT+.AWLGI	;GET NUMBER OF CHARACTERS IN ACCOUNT STRING
	SOS T3			;DO NOT COUNT FIRST NULL
	JRST TRDSK4		;GO PAD REMAINDER OF RECORD

; HERE TO OUTPUT NUMERIC ACCOUNT

TRDSK2:	HRROI T2,SPCBUF		;GET POINTER TO SPACE BUFFER
	MOVNI T3,^D27		;GET # OF SPACES TO OUTPUT
	SOUT			;OUTPUT FILLER
	MOVE T2,FCTENT+.AWDSK	;GET ACCOUNT TYPE WORD (NUMERIC ACCOUNT #)
	MOVX T3,<FLD(^D12,NO%COL)+FLD(^D10,NO%RDX)+NO%LFL>
	NOUT			;OUTPUT ACCOUNT NUMBER
	 JSERR			;UNEXPECTED ERROR
	MOVEI T3,.FSACT		;NUMBER OF CHARACTERS IN ACCOUNT STRING

; HERE TO OUTPUT FILLER TO # OF FILE PAGES, # OF FILE PAGES, AND REST OF RECORD

TRDSK4:	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	HRROI T2,SPCBUF		;GET POINTER TO SPACES
	SUBI T3,.FSACT+.FSCON
	SOUT			;OUTPUT FILLER
	LOAD T2,ENTFIL		;GET # OF FILE PAGES USED
	MOVX T3,NUMFLG		;GET NUMERIC FIELD FLAGS
	NOUT			;OUTPUT # OF FILE PAGES USED
	 JSERR			;UNEXPECTED ERROR
	HRROI T2,SPCBUF		;GET POINTER TO SPACES
	MOVNI T3,.FSLPT+.FSCDR+.FSDEV
	SOUT			;OUTPUT PADDING
	HRROI T2,EOR		;GET POINTER TO END OF RECORD
	SETZM T3		;TERMINATE ON NULL
	SOUT			;OUTPUT END-OF-RECORD
	RET			;RETURN
SUBTTL	PROCESS CDR ENTRIES

TRCDR:	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	LOAD T2,ENTRUN		;GET RUNTIME FROM ENTRY
	MOVX T3,NUMFLG		;GET NUMERIC FIELD FLAGS
	NOUT			;OUTPUT RUNTIME
	 JSERR			;UNEXPECTED ERROR
	MOVEI T1,.AWCDR		;GET INDEX TO ACCOUNT WORD IN ENTRY
	CALL TSTACT		;GO TEST ACCOUNT TO SEE IF NUMERIC
	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	MOVEI T2,"A"		;GET "ALPHANUMERIC ACCOUNT" INDICATOR
	SKIPL FCTENT+.AWCDR	;NUMERIC ACCOUNT ?
	MOVEI T2,"N"		;YES, GET "NUMERIC ACCOUNT" INDICATOR
	BOUT			;OUTPUT ACCOUNT TYPE

; OUTPUT ACCOUNT

	SKIPL FCTENT+.AWCDR	;NUMERIC ACCOUNT ?
	JRST TRCDR2		;YES, GO OUTPUT NUMERIC ACCOUNT
	HRROI T2,FCTENT+.AWCDR+1 ;GET POINTER TO ACCOUNT STRING
	MOVE T3,FCTENT+.AWCDR	;GET -<NUMBER OF CHARS> IN ACCOUNT STRING
	SOUT			;OUTPUT ACCOUNT STRING
	MOVN T3,FCTENT+.AWLGI	;GET NUMBER OF CHARACTERS IN ACCOUNT STRING
	SOS T3			;DO NOT COUNT FIRST NULL
	JRST TRCDR4		;GO PAD REMAINDER OF RECORD

; HERE TO OUTPUT NUMERIC ACCOUNT

TRCDR2:	HRROI T2,SPCBUF		;GET POINTER TO SPACE BUFFER
	MOVNI T3,^D27		;GET # OF SPACES TO OUTPUT
	SOUT			;OUTPUT FILLER
	MOVE T2,FCTENT+.AWCDR	;GET ACCOUNT TYPE WORD (NUMERIC ACCOUNT #)
	MOVX T3,<FLD(^D12,NO%COL)+FLD(^D10,NO%RDX)+NO%LFL>
	NOUT			;OUTPUT ACCOUNT NUMBER
	 JSERR			;UNEXPECTED ERROR
	MOVEI T3,.FSACT		;NUMBER OF CHARACTERS IN ACCOUNT STRING

; HERE TO OUTPUT FILLER FOR ACCOUNT NUMBER, FILLER TO # OF FILE PAGES,
; # OF FILE PAGES, AND REST OF RECORD

TRCDR4:	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	HRROI T2,SPCBUF		;GET POINTER TO SPACES
	SUBI T3,.FSACT+.FSCON+.FSFIL+.FSLPT ;GET # OF COL IN FIELDS TO CDR FIELD
	SOUT			;OUTPUT FILLER
	LOAD T2,ENTQUA		;GET QUANTITY OF OUTPUT
	MOVX T3,NUMFLG		;GET NUMERIC OUTPUT FLAGS
	NOUT			;OUTPUT NUMBER OF CARDS READ
	 JSERR			;UNEXPECTED ERROR
	MOVE T1,[NAMBUF,,NAMBUF+1] ;SET UP TO CLEAR NAME BUFFER
	SETZM NAMBUF		;CLEAR FIRST WORD OF BUFFER
	BLT T1,NAMBUF+NAMSIZ-1	;CLEAR NAME BUFFER
	HRROI T1,NAMBUF		;GET POINTER TO NAME BUFFER
	LOAD T2,ENTDEV		;GET DEVICE DESIGNATOR FROM ENTRY
	DEVST			;CONVERT DEVICE DESIGNATOR TO STRING
	 JSERR			;UNEXPECTED ERROR
	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	HRROI T2,NAMBUF		;GET POINTER TO NAME BUFFER
	MOVEI T3,.FSDEV		;GET MAXIMUM # OF CHARACTERS IN FIELD
	MOVEI T4,.CHNUL		;GET TERMINATING CHARACTER
	SOUT			;OUTPUT DEVICE NAME TO OUTPUT FILE
	MOVEI T2," "		;GET A SPACE FOR FILLER
	JUMPE T3,TRCDR6		;GO ON IF DONE
TRCDR5:	BOUT			;OUTPUT A SPACE
	SOJG T3,TRCDR5		;LOOP UNTIL ENTIRE FIELD IS FULL
TRCDR6:	HRROI T2,EOR		;GET END-OF-RECORD
	SETZM T3		;TERMINATE ON NULL
	SOUT			;OUTPUT END OF RECORD
	RET			;RETURN
SUBTTL	PROCESS LPT ENTRIES

TRLPT:	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	LOAD T2,ENTRUN		;GET RUNTIME FROM ENTRY
	MOVX T3,NUMFLG		;GET NUMERIC FIELD FLAGS
	NOUT			;OUTPUT RUNTIME
	 JSERR			;UNEXPECTED ERROR
	MOVEI T1,.AWLPT		;GET INDEX TO ACCOUNT WORD IN ENTRY
	CALL TSTACT		;GO TEST ACCOUNT TO SEE IF NUMERIC
	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	MOVEI T2,"A"		;GET "ALPHANUMERIC ACCOUNT" INDICATOR
	SKIPL FCTENT+.AWLPT	;NUMERIC ACCOUNT ?
	MOVEI T2,"N"		;YES, GET "NUMERIC ACCOUNT" INDICATOR
	BOUT			;OUTPUT ACCOUNT TYPE

; OUTPUT ACCOUNT

	SKIPL FCTENT+.AWLPT	;NUMERIC ACCOUNT ?
	JRST TRLPT2		;YES, GO OUTPUT NUMERIC ACCOUNT
	HRROI T2,FCTENT+.AWLPT+1 ;GET POINTER TO ACCOUNT STRING
	MOVE T3,FCTENT+.AWLPT	;GET -<NUMBER OF CHARS> IN ACCOUNT STRING
	SOUT			;OUTPUT ACCOUNT STRING
	MOVN T3,FCTENT+.AWLGI	;GET NUMBER OF CHARACTERS IN ACCOUNT STRING
	SOS T3			;DO NOT COUNT FIRST NULL
	JRST TRLPT4		;GO PAD REMAINDER OF RECORD

; HERE TO OUTPUT NUMERIC ACCOUNT

TRLPT2:	HRROI T2,SPCBUF		;GET POINTER TO SPACE BUFFER
	MOVNI T3,^D27		;GET # OF SPACES TO OUTPUT
	SOUT			;OUTPUT FILLER
	MOVE T2,FCTENT+.AWLPT	;GET ACCOUNT TYPE WORD (NUMERIC ACCOUNT #)
	MOVX T3,<FLD(^D12,NO%COL)+FLD(^D10,NO%RDX)+NO%LFL>
	NOUT			;OUTPUT ACCOUNT NUMBER
	 JSERR			;UNEXPECTED ERROR
	MOVEI T3,.FSACT		;NUMBER OF CHARACTERS IN ACCOUNT STRING

; HERE TO OUTPUT FILLER

TRLPT4:	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	HRROI T2,SPCBUF		;GET POINTER TO SPACES
	SUBI T3,.FSACT+.FSCON+.FSFIL ;GET # OF COLUMNS IN FIELDS TO LPT FIELD
	SOUT			;OUTPUT FILLER
	LOAD T2,ENTQUA		;GET QUANTITY OF OUTPUT
	MOVX T3,NUMFLG		;GET NUMERIC OUTPUT FLAGS
	NOUT			;OUTPUT NUMBER OF PAGES PRINTED
	 JSERR			;UNEXPECTED ERROR
	MOVEI T2,0		;GET A ZERO
	MOVX T3,NUMFLG		;GET NUMERIC FIELD FLAGS
	NOUT			;OUTPUT # OF CARDS
	 JSERR			;UNEXPECTED ERROR
	MOVE T1,[NAMBUF,,NAMBUF+1] ;SET UP TO CLEAR NAME BUFFER
	SETZM NAMBUF		;CLEAR FIRST WORD OF BUFFER
	BLT T1,NAMBUF+NAMSIZ-1	;CLEAR NAME BUFFER
	HRROI T1,NAMBUF		;GET POINTER TO NAME BUFFER
	LOAD T2,ENTDEV		;GET DEVICE DESIGNATOR FROM ENTRY
	DEVST			;CONVERT DEVICE DESIGNATOR TO STRING
	 JSERR			;UNEXPECTED ERROR
	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	HRROI T2,NAMBUF		;GET POINTER TO NAME BUFFER
	MOVEI T3,.FSDEV		;GET MAXIMUM # OF CHARACTERS IN FIELD
	MOVEI T4,.CHNUL		;GET TERMINATING CHARACTER
	SOUT			;OUTPUT DEVICE NAME TO OUTPUT FILE
	MOVEI T2," "		;GET A SPACE FOR FILLER
	JUMPE T3,TRLPT6		;GO ON IF DONE
TRLPT5:	BOUT			;OUTPUT A SPACE
	SOJG T3,TRLPT5		;LOOP UNTIL ENTIRE FIELD IS FULL
TRLPT6:	HRROI T2,EOR		;GET END-OF-RECORD
	SETZM T3		;TERMINATE ON NULL
	SOUT			;OUTPUT END OF RECORD
	RET			;RETURN
SUBTTL	SUBROUTINES

; GET NEXT ENTRY FROM FACT FILE
;
; CALL:		CALL GETENT
; RETURNS:	T1/INDEX INTO TYPTAB (TABLE OF KNOWN ENTRY TYPE CODES)

GETENT:	STKVAR <GTENTF,GTENTI>	;ALLOCATE "UNKNOWN ENTRY SEEN" FLAG
	SETOM GTENTF		;INDICATE NO UNKOWN ENTRIES SEEN
GETEN1:	MOVE T1,[FCTENT,,FCTENT+1] ;SET UP TO CLEAR FACT ENTRY
	SETZM FCTENT		;CLEAR FIRST WORD OF FACT ENTRY BLOCK
	BLT T1,FCTENT+ENTMSZ-1	;CLEAR FACT ENTRY BLOCK
	MOVE T1,INJFN		;GET JFN FOR INPUT FACT FILE
	BIN			;INPUT FIRST WORD OF AN ENTRY
	MOVEM T2,FCTENT		;STORE FIRST WORD OF FACT FILE ENTRY

	MOVEI T1,TYPSIZ-1	;GET INITIAL INDEX INTO TYPE TABLE
	LOAD T2,ENTCOD;		;GET ENTRY TYPE CODE FROM ENTRY
GETEN2:	HLRZ T3,TYPTAB(T1)	;GET ENTRY TYPE CODE FROM TABLE
	CAMN T3,T2		;FOUND A KNOWN TYPE CODE ?
	JRST GETEN5		;YES, GO INPUT REMAINDER OF ENTRY
	SOJGE T1,GETEN2		;NO, GO CHECK NEXT TABLE ENTRY

; HERE IF ENTRY TYPE CODE NOT IN TABLE OF KNOWN CODES

	SKIPL GTENTF		;ANY UNKNOWN ENTRIES PREVIOUSLY ENCOUNTERED ?
	JRST GETEN1		;YES, DO NOT ISSUE MESSAGE AGAIN
	SETZM GTENTF		;INDICATE AN UNKNOWN ENTRY HAS BEEN FOUND
	CALL TSTCOL		;OUTPUT CRLF IF NEEDED
	TMSG <% ACCTPR: Unknown entry type >
	MOVEI T1,.PRIOU		;GET PRIMARY OUTPUT JFN
	LOAD T2,ENTCOD;		;GET ENTRY TYPE CODE
	MOVX T3,^D8		;USE OCTAL RADIX
	NOUT			;OUTPUT ENTRY TYPE
	 JSERR			;UNEXPECTED ERROR
	TMSG < encountered
>				;OUTPUT END OF MESSAGE
	JRST GETEN1		;GO GET NEXT WORD FROM INPUT FILE

; HERE TO INPUT REMAINDER OF ENTRY

GETEN5:	MOVEM T1,GTENTI		;SAVE INDEX INTO TYPTAB
	LOAD T3,ENTSIZ		;GET SIZE OF ENTRY
	SUBI T3,1		;COMPENSATE FOR HEADER WORD, ALREADY INPUT
	JUMPE T3,GETEN8		;IF NO MORE TO INPUT, RETURN
	MOVN T3,T3		;GET NEGATIVE # OF WORDS TO INPUT
	MOVE T1,INJFN		;GET INPUT JFN
	MOVX T2,<POINT 36,FCTENT+.EFUSR> ;GET POINTER TO WHERE ENTRY GOES
	SIN			;INPUT REMAINDER OF FACT ENTRY

GETEN8:	LOAD T1,ENTUSR		;GET USER NUMBER FROM FACT ENTRY
	TLNN T1,-1		;OLD STYLE USER NUMBER ?
	HRLI T1,500000		;YES, CONVERT TO NEW STYLE USER NUMBER
	STOR T1,ENTUSR		;REPLACE USER NUMBER IN FACT ENTRY
	MOVE T1,GTENTI		;RESTORE INDEX INTO TYPTAB
	RET			;RETURN TO WHENCE WE CAME ...
; SUBROUTINE TO OUTPUT THE ENTRY TYPE CODE, JOB #, AND TERMINAL LINE #
;
; CALL:		CALL DOHDR1
; RETURNS: +1 ALWAYS

DOHDR1:	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	LOAD T2,ENTCOD		;GET ENTRY TYPE CODE
	MOVX T3,<FLD(3,NO%COL)+FLD(^D8,NO%RDX)+NO%LFL+NO%ZRO>
	NOUT			;OUTPUT ENTRY TYPE CODE
	 JSERR			;UNEXPECTED ERROR
	LOAD T2,ENTJOB		;GET JOB NUMBER FROM ENTRY
	MOVX T3,<FLD(3,NO%COL)+FLD(^D10,NO%RDX)+NO%LFL+NO%ZRO>
	NOUT			;OUTPUT JOB NUMBER
	 JSERR			;UNEXPECTED ERROR
	LOAD T2,ENTLIN		;GET TERMINAL LINE NUMBER FROM ENTRY
	MOVX T3,<FLD(4,NO%COL)+FLD(^D8,NO%RDX)+NO%LFL+NO%ZRO>
	NOUT			;OUTPUT TERMINAL LINE NUMBER
	 JSERR			;UNEXPECTED ERROR
	RET			;RETURN TO WHENCE WE CAME ...
; OUTPUT DIRECTORY #, DIRECTORY NAME, AND TIME AND DATE TO OUTPUT FILE
;
; CALL:		CALL DOHDR2
; RETURNS: +1 ALWAYS

DOHDR2:	STKVAR <DOHD2D,DOHD2M,DOHD2Y>; ;ALLOCATE LOCAL STORAGE
	MOVE T1,[ASCII /     /]	;GET FIVE SPACES
	MOVEM T1,NAMBUF		;STORE AT FIRST WORD IN NAMBUF
	MOVE T1,[NAMBUF,,NAMBUF+1] ;SET UP TO CLEAR NAME BUFFER
	BLT T1,NAMBUF+NAMSIZ-1	;CLEAR NAME BUFFER TO SPACES
	LOAD T2,ENTCOD		;GET ENTRY CODE
	CAIN T2,.EFDSK		;DISKS ARE SPECIAL
	JRST [	LOAD T1,ENTSIZ	;GET SIZE
		SETZM FCTENT(T1) ;GRNTEE NULL AT END
		MOVEI T1,0	;ASSUME NUMERIC
		HLRZ T2,FCTENT+.AWDSK
		CAIN T2,-1	;???
		CALL [	MOVN T1,FCTENT+.AWDSK ;ALPHA - GET SIZE
			IDIVI T1,NCHPW
			SKIPE T2
			AOS T1		;ADJUST TO # OF WORDS
			RET]
		HRROI T2,FCTENT+.AWDSK+2(T1) ;POINT TO STRING
		HRROI T1,NAMBUF ;COPY TO NAME BUFFER
		MOVEI T3,0
		SOUT
		JRST DOHD2A]	;CONTINUE PROCESSING
	HRROI T1,NAMBUF		;GET POINTER TO NAME BUFFER
	LOAD T2,ENTUSR		;GET USER NUMBER
	DIRST			;OUTPUT DIRECTORY NAME
	 JRST [	MOVEI T3,.FSNAM	;CANNOT TRANSLATE, GET # OF COLUMNS IN FIELD
		JRST DOHD2B ]	;GO PAD FIELD WITH SPACES
DOHD2A:	MOVEI T4," "		;GET A SPACE
	IDPB T4,T1		;STORE A SPACE TO TERMINATE NAME STRING
	MOVE T1,OUTJFN		;GET OUTPUT JFN
	HRROI T2,NAMBUF		;GET POINTER TO DIRECTORY NAME
	MOVEI T3,.FSNAM		;GET MAXIMUM CHARACTER COUNT
	MOVEI T4," "		;GET TERMINATING CHARACTER
	SOUT			;OUTPUT DIRECTORY NAME
	JUMPE T3,DOHD2E		;IF ENTIRE FIELD FILLED, GO ON
DOHD2B:	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	MOVEI T2," "		;GET A SPACE
DOHD2C:	BOUT			;OUTPUT A SPACE AS FILLER
	SOJG T3,DOHD2C		;LOOP UNTIL ENTIRE FIELD FILLED
	; ..
	; ..
DOHD2E:	LOAD T2,ENTTAD		;GET TIME AND DATE FROM ENTRY
	SETZM T4		;NORMAL FORMAT
	ODCNV			;GET DATE AND TIME IN DAY, MONTH, YEAR
	HLRZM T3,DOHD2D		;SAVE DAY OF MONTH
	HRRZM T2,DOHD2M		;SAVE MONTH
	HLRZM T2,DOHD2Y		;SAVE YEAR
	MOVEI T1,1		;ODCNV RETURNS DAY FROM 0-6, MONTH FROM 0-11
	ADDM T1,DOHD2D		;MAKE DAY BE BETWEEN 1 AND 7
	ADDM T1,DOHD2M		;MAKE DAY BE BETWEEN 1 AND 12
	MOVE T1,DOHD2Y		;GET YEAR
	IDIVI T1,^D100		;REMAINDER IS LAST TWO DIGITS OF YEAR
	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	MOVX T3,<FLD(2,NO%COL)+FLD(^D10,NO%RDX)+NO%LFL+NO%ZRO>
	NOUT			;OUTPUT YEAR
	 JSERR			;UNEXPECTED ERROR
	MOVE T1,OUTJFN		;GET OUTPUT FILE JFN
	MOVE T2,DOHD2M		;GET MONTH
	NOUT			;OUTPUT MONTH
	 JSERR			;UNEXPECTED ERROR
	MOVE T2,DOHD2D		;GET DAY OF MONTH
	NOUT			;OUTPUT DAY OF MONTH
	 JSERR			;UNEXPECTED ERROR
	LOAD T2,ENTTAD		;GET TIME AND DATE FROM ENTRY AGAIN
	MOVX T3,1B0+1B10+1B12	;OMIT DATE FROM OUTPUT
	ODTIM			;OUTPUT TIME
	RET			;RETURN
; ROUTINE TO TEST ACCOUNTS IN FACT ENTRIES, CONVERTING ALPHANUMERIC
; ACCOUNTS OF ALL DIGITS TO THE EQUIVALENT NUMERIC ACCOUNT, AND TO TURN
; OFF NUMERIC ACCOUNT DESIGNATOR IF ON.


; CALL:	ACCEPTS IN T1/ INDEX INTO FACT ENTRY OF ACCOUNT TYPE WORD
;		CALL TSTACT
; RETURNS: +1 ALWAYS, FACT ENTRY CHANGED IF REQUIRED

TSTACT:	HLRZ T2,FCTENT(T1)	;PICK UP LEFT HALF OF ACCOUNT NUMBER
	CAIN T2,-1		;ALPHANUMERIC ACCOUNT IN ENTRY
	JRST TSTAC1		;YES
	TRZ T2,500000		;NO, TURN OFF NUMERIC ACCOUNT INDICATOR
	HRLM T2,FCTENT(T1)	;STORE RIGHT HALF BACK
	RET			;RETURN
TSTAC1:	STKVAR <TACTWD>		;ALLOCATE LOCAL STORAGE
	MOVEM T1,TACTWD		;SAVE INDEX INTO FACT ENTRY TO ACCOUNT WORD
	HRROI T1,FCTENT+1(T1)	;GET POINTER TO ACCOUNT STRING IN ENTRY
	MOVX T3,<FLD(^D10,NO%RDX)> ;GET DECIMAL RADIX
	NIN			;INPUT NUMBER FROM ACCOUNT STRING
	 RET			;RETURN IF FIRST CHARACTER NOT A DIGIT
	LDB T1,T1		;GET TERMINATING CHARACTER
	JUMPN T1,R		;RETURN IF TERMINATED BY A NON-DIGIT CHARACTER
	MOVE T1,TACTWD		;GET INDEX TO ACCOUNT WORD IN FACT ENTRY
	MOVEM T2,FCTENT(T1)	;SAVE NUMERIC ACCOUNT IN FACT ENTRY
	RET			;RETURN


; output last error string to terminal

typerr:	MOVEI T1,.PRIOU		;GET PRIMARY OUTPUT JFN
	HRLOI T2,.FHSLF		;GET OUR FORK HANDLE
	SETZM T3		;NO LIMIT
	ERSTR			;OUTPUT GTJFN ERROR MESSAGE
	 JFCL			;IGNORE ERSTR ERRORS
	 JFCL			;IGNORE ERSTR ERRORS
	RET			;RETURN
SUBTTL	COMMAND ERROR SUBROUTINES

; INVALID END-OF-COMMAND

COMER1:	CALL TSTCOL		;TEST COLUMN POSITION
	TMSG <? CHKPNT: Garbage at end-of-command
>				;OUTPUT ERROR MESSAGE
	RET			;RETURN TO WHENCE WE CAME ...


; SUBROUTINE TO TEST COLUMN POSITION AND OUTPUT CRLF IF NEEDED

TSTCOL:	movei t1,.priou		;get primary output designator
	rfpos			;read file position
	hrrz t2,t2		;keep just the column position
	JUMPE T2,R		;IF AT COLUMN 1 DO NOT OUTPUT CRLF
	tmsg <
>				;no, output a crlf
	RET			;RETURN TO WHENCE WE CAME ...
SUBTTL CONSTANTS AND TABLES

DEFINE TB(RTN,TXT)
<	[ASCIZ/TXT/] ,, RTN
>

CMDTAB: CMDSIZ-1,, CMDSIZ
	TB (.EXIT,EXIT)
	TB (.HELP,HELP)
	TB (.TRANS,TRANSLATE)

	CMDSIZ==.-CMDTAB

PROMPT:	ASCIZ /ACCTPR>/

; TABLE OF KNOWN ENTRY CODE TYPES

TYPTAB:	.EFLGI ,, TRLGI
	.EFLGO ,, TRLGO
	.EFDET ,, TRDET
	.EFATT ,, TRATT
	.EFCAC ,, TRCAC
	.EFCHK ,, TRCHK
	.EFSDU ,, TRSDU
	.EFDSK ,, TRDSK
	.EFRES ,, TRRES
	.EFTIM ,, TRTIM
	.EFLPT ,, TRLPT
	.EFCDR ,, TRCDR

	TYPSIZ==.-TYPTAB
; ENTRY VECTOR

ENTVEC:	JRST START
	JRST START
	VACCTP

; TABLES FOR INTERRUPT SYSTEM

LEVTAB:	RETPC1
	RETPC2
	RETPC3

CHNTAB:	REPEAT .ICEOF, <0>
	1,, EOFINT
	REPEAT ^D36-.ICEOF-1, <0>

; BUFFER OF SPACES FOR USE IN PADDING

SPCBUF:	REPEAT ^D34, <ASCII "     ">
	ASCIZ " "

EOR:	ASCIZ /
/				;END-OF-RECORD TEXT

; HELP TEXT

HLPMSG:	ASCIZ /
FUNCTION
	ACCTPR translates the entries in the binary accounting files
(FACT files) to a printable, ascii text file.  This text file is
suitable for use as input to a subsequent processing program for sorting,
data reduction, report generation, and so on. The prompt which indicates
the program's readyness to accept commands is ACCTPR>.

COMMANDS

TRANSLATE (FACT FILE) FILE-SPEC (TO) OUTPUT-FILE-SPEC
EXIT (TO MONITOR)
HELP

/
SUBTTL	VARIABLE DATA STORAGE

RETPC1:	BLOCK 1			;RETURN PC 1 FOR INTERRUPT SYSTEM
RETPC2:	BLOCK 1			;RETURN PC 2 FOR INTERRUPT SYSTEM
RETPC3:	BLOCK 1			;RETURN PC 3 FOR INTERRUPT SYSTEM
CMDBLK:	BLOCK .CMGJB+5		;COMMAND STATE BLOCK FOR COMND JSYS
BUFFER:	BLOCK BUFSIZ		;INPUT TEXT STORED HERE
ATMBFR:	BLOCK ATMSIZ		;ATOM BUFFER FOR COMND JSYS
GJFBLK:	BLOCK GJFSIZ		;GTJFN BLOCK FOR COMND JSYS
NAMBUF:	BLOCK NAMSIZ		;NAME BUFFER
HITAD:	BLOCK 1			;HIGHEST TIME AND DATE SEEN THUS FAR
FCTENT:	BLOCK ENTMSZ		;FACT FILE ENTRY GOES HERE
INJFN:	BLOCK 1			;INPUT FACT FILE JFN
OUTJFN:	BLOCK 1			;OUTPUT FILE JFN
PDL:	BLOCK PDLEN		;PUSH DOWN POINTER

	END <3,,ENTVEC>