.TITLE ACNTLG - MAINTAINS LG:[1,2]ACOUNT.LOG .IDENT /01.01/ .ENABL LC .ENABL LSB .NLIST BEX ;+ ; Title: ACNTLG - Maintains LG:[1,2]ACOUNT.LOG file ; Version: 01.01 ; By: Greg Thompson (Informatics/PMI) ; (Based on a version by Teri Becker) ; Date: 8/12/78 ; ; This task outputs logging information to the account log ; file: LG:[1,2]ACOUNT.LOG. The task accepts receive data packets ; sent to it by HEL, BYE, and RESTRT tasks. ; ; Format of Receive data buffer ; _______________________________ ; ! ! ; 4 ! 1=HELLO, 2=BYE, 3=RSTLOG ! ; !_______________________________! <===== ; ! ! ! ; 6 ! Year (since 1900) ! ! ; !_______________________________! ! ; ! ! ! ; 10 ! Month (1-12) ! ! ; !_______________________________! ! ; ! ! ! ; 12 ! Day (1-31) ! ! ; !_______________________________! ! ; ! ! ! ; 14 ! Hour (0-23) ! ! ; !_______________________________! +=> In GTIM$ format ; ! ! ! ; 16 ! Minute (0-59) ! ! ; !_______________________________! ! ; ! ! ! ; 20 ! Second (0-59) ! ! ; !_______________________________! ! ; ! ! ! ; 22 ! Tick of second ! ! ; !_______________________________! ! ; ! ! ! ; 24 ! Ticks per second ! ! ; !_______________________________! <===== ; ! ! ! ; 26 ! User Identification Code ! ! ; !_______________________________! ! ; ! ! ! ; 30 ! Terminal device name ! +=> Only for HEL and BYE ; !_______________________________! ! ; ! ! ! ; 32 ! Terminal device unit number ! ! ; !_______________________________! <===== ; ! ! ; 34 ! (Reserved) ! ; !_______________________________! ; ; ; Lines are output to LG:[1,2]ACOUNT.LOG in the following format: ; ; 1 10 19 27 31 36 (40 BYTE RECORDS) ; 06/14/78 13:46:22 HELLO [001,054] VT003 ; 06/14/78 14:19:37 BYE [001,054] VT003 ; 07/01/78 01:14:59 HELLO [100,100] TT101 ; 07/02/78 19:12:22 RSTLOG ; ; The account file is purposely written in a form easy to read ; and to use as input to fortran programs. ; ; To turn off account logging just remove the ACOUNT task. ; ; During startup (in LG:[1,2]STARTUP.CMD) RSTLOG should be ; inorder to log the fact that the system has been restarted. ; ; Task build: ; TKB>[1,54]ACNTLG/SE/CP,[1,34]ACNTLG/-SP=[1,24]MCR/LB:ACNTLG ; TKB>/ ; ENTER OPTIONS ; TKB>STACK=64 ; TKB>UNITS=2 ; TKB>// ;- .MCALL FSRSZ$,FDBDF$,FDAT$A,FDRC$A,FDOP$A,FINIT$ .MCALL PUT$R,OPEN$A,OPEN$W,RCVX$S,CLOSE$ .MCALL ALUN$C,QIO$C,MRKT$C,WTLO$C,QIOW$C ; FSRSZ$ 1 ; Generate FSR block pool ; OUTSIZ = 40. ; Number of bytes in output record OUTLUN = 1 ; LUN for output COLUN = 2 ; LUN for operators console output COEF = 2 ; Event Flag for CO: output TIMEEF = 3 ; Event Flag for timer SECS = 10. ; Seconds to wait for operators console WTMASK = 6 ; Mask for WTLO$C MAXTSK = 3 ; Maximum source task number FILPRO = 167016 ; File protection [R,RWED,R,R] ; TASKS: .ASCII /HELLO / ; Task names (6 characters each) .ASCII /BYE / ; .ASCII /RSTLOG/ ; ; ERRMSG: .ASCII /ACNTLG -- Unable to open account log file, error / ERCODE: .ASCIZ / / ERRLNG = .-ERRMSG .EVEN ; FDBOUT: FDBDF$ ; Allocate FDB for file FDAT$A R.FIX,FD.CR,OUTSIZ ; Define file attributes FDRC$A ,OUTBUF,OUTSIZ ; Define record access characteristics FDOP$A OUTLUN,OUTNAM ; Define LUN and name of file ; OUTNAM: .WORD 4. ; Dataset descriptor .WORD DEVNM ; Device name pointer .WORD 5. ; .WORD DIRNM ; Directory name pointer .WORD 10. ; .WORD FILNM ; File name pointer ; DEVNM: .ASCII /LG0:/ ; (Pseudo) device name DIRNM: .ASCII /[1,2]/ ; Directory name FILNM: .ASCII /ACOUNT.LOG/ ; File name .EVEN ; ; DATBUF: .BLKW 15. ; Receive data buffer OUTBUF: .BLKB OUTSIZ ; Output buffer .EVEN ; ; ; Account logging routine ; ACNTLG: RCVX$S ,#DATBUF ; Receive message or exit ; ; Format output message ; MOV #OUTBUF,R0 ; R0 -> output buffer MOV DATBUF+10,R1 ; R1 = Month MOV PC,R2 ; Don't suppress leading zero CALL $CBDAT ; Output 2 digit month MOVB #'/,(R0)+ ; Slash is next MOV DATBUF+12,R1 ; R1 = Day MOV PC,R2 ; Don't suppress leading zero CALL $CBDAT ; Output 2 digit day MOVB #'/,(R0)+ ; Slash is next MOV DATBUF+6,R1 ; R1 = Year MOV PC,R2 ; Don't suppress leading zero CALL $CBDAT ; Output 2 digit year MOVB #' ,(R0)+ ; Space between date and time MOV #DATBUF+14,R1 ; R1 = Address of hour MOV #3,R2 ; Output in HH:MM:SS format CALL $TIM ; Output time MOVB #' ,(R0)+ ; Space between time and task name MOV DATBUF+4,R1 ; Get task number BLE ACNTLG ; Ignore message if bad CMP R1,#MAXTSK ; Check upper bound too BGT ACNTLG ; ASL R1 ; Multiply number by six MOV R1,R2 ; R1 = number*2 ADD R1,R2 ; ADD R1,R2 ; R2 = number*6 ADD #TASKS-6,R2 ; R2 -> source task name MOVB (R2)+,(R0)+ ; Output source task name MOVB (R2)+,(R0)+ ; MOVB (R2)+,(R0)+ ; MOVB (R2)+,(R0)+ ; MOVB (R2)+,(R0)+ ; MOVB (R2)+,(R0)+ ; MOVB #' ,(R0)+ ; Space is next CMP #3,DATBUF+4 ; Was task = RSTLOG? BNE 10$ ; No, output uic etc. MOVB #' ,(R0)+ ; Yes, output 15 spaces MOVB #' ,(R0)+ ; MOVB #' ,(R0)+ ; MOVB #' ,(R0)+ ; MOVB #' ,(R0)+ ; MOVB #' ,(R0)+ ; MOVB #' ,(R0)+ ; MOVB #' ,(R0)+ ; MOVB #' ,(R0)+ ; MOVB #' ,(R0)+ ; MOVB #' ,(R0)+ ; MOVB #' ,(R0)+ ; MOVB #' ,(R0)+ ; MOVB #' ,(R0)+ ; MOVB #' ,(R0)+ ; BR 20$ ; Continue ; 10$: MOVB #'[,(R0)+ ; Bracket is next MOVB DATBUF+27,R1 ; Get group code BIC #177400,R1 ; Clear high order byte MOV #15010,R2 ; Radix 8 unsigned no sup 3 byte field CALL $CBTA ; Convert group code MOVB #',,(R0)+ ; Comma in between MOVB DATBUF+26,R1 ; Get member code BIC #177400,R1 ; Clear high byte MOV #15010,R2 ; Radix 8 unsigned no sup 3 byte field CALL $CBTA ; Convert member code MOVB #'],(R0)+ ; Right bracket is next MOVB #' ,(R0)+ ; Followed by space MOVB DATBUF+30,(R0)+ ; Device name next MOVB DATBUF+31,(R0)+ ; Both characters MOV DATBUF+32,R1 ; Get unit number MOV #15010,R2 ; Radix 8 unsigned no sup 3 byte field CALL $CBTA ; Convert unit number ; ; Now output message to file ; 20$: FINIT$ ; Init FSR OPEN$A #FDBOUT ; Open existing file for append BCC 30$ ; No error on open CMPB #IE.NSF&377,FDBOUT+F.ERR ; Was error "No such file" BNE 50$ ; No, can't open output file MOV #FILPRO,R1 ; Set file protection value to use CALL .WDFFP ; Write default file protection OPEN$W #FDBOUT ; Yes, well try to create new file BCS 50$ ; Unable to, give up 30$: PUT$R #FDBOUT ; Output new record CLOSE$ #FDBOUT ; Close file 40$: JMP ACNTLG ; And wait for next entry ; ; Unable to open account file, report error to operator ; 50$: ALUN$C COLUN,CO,0 ; Assign CO: device BCS 40$ ; We tried ... MOV #ERCODE,R0 ; Get address for error code MOVB FDBOUT+F.ERR,R1 ; Get error code from FDB CLR R2 ; Supress leading zeros CALL $CBDSG ; Convert to signed decimal MOVB #'.,(R0)+ ; Put trailing period on number QIO$C IO.CCO,COLUN,COEF,,,, ; Write to operator BCS 40$ ; Don't wait if error MRKT$C TIMEEF,SECS,2 ; Start timer BCS 40$ ; Don't want to hang up WTLO$C 0,WTMASK ; Wait for I/O to complete or timer QIOW$C IO.KIL,COLUN,COEF ; Kill any of our I/O BR 40$ ; Check for more work ; .END ACNTLG ; End of program