.TITLE BAPMSG .IDENT /V3.01/ .NLIST BEX .ENABL LC ;************************************************************************ ; ; BAPMSG.FTN ; ; This routine is called when a job starts or ends. A message ; is broadcast to each terminal logged on to the account under ; which the job is starting. ; Up to "NTERM" terminals can be handled. ; ;------------------------------------------------------------------------ ; ; Steve Thompson ; School of Chemical Engineering ; Olin Hall ; Cornell University ; Ithaca NY 14853 ; ;------------------------------------------------------------------------ ; ; Modification History ; ==================== ; ; SMT302 1-JUN-83 Steve Thompson ; Don't send messages if nobroadcast bit is ; set (alternate CLI support only). ; ;************************************************************************** .MCALL DIR$, QIOW$ NTERM = 5. ; Maximum size of UCB buffer ; ; Text messages. ; .IF DF,B3$MSG MSG: .BYTE BELL,CR MSGT: .ASCII /HH:MM:SS / MSGD: .ASCII /DD-MMM-YY/ .EVEN ; ; UCB address table. ; UCBTAB: .REPT NTERM .WORD 0 .ENDR .WORD 0 ; End of table ; ; Directive parameter blocks. ; HDROUT: QIOW$ IO.WBT,MSGLUN,EFNMSG,,,, .PAGE .SBTTL MAIN LINE CODE ;+ ; **-MESSAG-Send message to user, informing of job start/end. ; ; Inputs: ; JOBUIC Job UIC ; R0 Message text address ; R1 Size of message in bytes ; ;- .IFTF MESSAG:: ; .IFT MOV R0,USWRIT+Q.IOPL ; Save message address in DPB MOV R1,USWRIT+Q.IOPL+2 ; Save message size in DPB CALL $SWSTK,90$ ; Switch stacks MOV #UCBTAB,R5 ;; Get address of UCB table MOV #NTERM,R1 ;; and its size 40$: MOV #$DEVHD,R4 ;; Get device listhead address 50$: MOV (R4),R4 ;; Get next DCB address BEQ 80$ ;; If EQ, end of list CMP D.NAM(R4),#"TT ;; Terminal? BNE 50$ ;; No, loop MOV D.UCB(R4),R0 ;; Get first UCB address CLR R2 ;; Get last unit number BISB D.UNIT+1(R4),R2 ;; CLR R3 ;; Get first unit number BISB D.UNIT(R4),R3 ;; SUB R3,R2 ;; Calculate number of units on this UCB INC R2 ;; 60$: CMP JOBUIC,U.LUIC(R0) ;; This terminal? (the match will ;; always fail if terminal is not ;; logged on) BNE 70$ ;; If NE no ;SMT302 .IF DF,A$$CLI ;SMT302 ;SMT302 BIT #UM.NBR,U.MUP(R0) ;; Nobroadcast bit set? ;SMT302 BNE 70$ ;; If NE yes, skip this unit ;SMT302 ;SMT302 .ENDC ; DF,A$$CLI ;SMT302 ;SMT302 MOV R0,(R5)+ ;; Save UCB address in table DEC R1 ;; Any space left? BLE 80$ ;; If le no 70$: ADD D.UCBL(R4),R0 ;; No, point to next UCB DEC R2 ;; Any more? BGT 60$ ;; If GT yes, loop BR 50$ ;; Try next DCB 80$: RETURN ;; Return to user state ; ; Format header message. ; 90$: MOV #MSGT,R0 ; Get place for time CALL TIME ; Fill it in MOV #MSGD,R0 ; Get place for date CALL DATE ; and fill that in SUB #MSG,R0 ; Calculate message length MOV R0,HDROUT+Q.IOPL+2 ; Save it in the DPB ; ; Send messages. ; 100$: MOV #UCBTAB,R5 ; Get address of UCB table MOV #NTERM,R4 ; And its size 110$: MOV (R5)+,R0 ; Get next UCB address BEQ 130$ ; If EQ, no more DEC R4 ; Table exhausted? BLE 130$ ; If LE yes CALL $SWSTK,120$ ; Switch stacks MOV $HEADR,R1 ;; Get our header address MOV R0,H.LUN+<4*>(R1) ;; Assign message LUN RETURN ;; Return to user level 120$: DIR$ #HDROUT ; Send header message DIR$ #USWRIT ; Send start/end message BR 110$ ; Loop 130$: ; Ref. label .IFTF RETURN ; Return to caller .ENDC ; DF,B3$MSG .END