;**************************************************************** ;* * ;* Programmer : HUNTER GOATLEY * ;* Program : MAILMSGFIX.MAR * ;* Shop : WKU/ACRS STH 110 * ;* Purpose : To set number of MAIL messages to 0 * ;* System : VAX 11/785 VAX/VMS v4.1 * ;* Date : October 13, 1985 * ;* * ;**************************************************************** ;* * ;* When a user deletes a MAIL.MAI file that contains * ;* unread mail messages, the message concerning new mail * ;* messages will not be updated. To prevent this message * ;* from printing on login and upon entering MAIL, this * ;* program will go into SYS$SYSTEM:VMSMAIL.DAT and set * ;* the number of messages to 0. * ;* * ;**************************************************************** ; CR=13 LF=10 ;************************ ;* * ;* Library Macro Calls * ;* * ;************************ ; $RMSDEF ; RMS symbols $FABDEF ; FAB symbols $RABDEF ; RAB symbols ; .PSECT DATA,LONG,NOEXE,WRT ; ; ;*** File Access Block for SYS$SYSTEM:VMSMAIL.DAT ; VMSMAILFAB: $FAB FNM=, - ; The File Name (SYSUAFC.IDX) FAC=, - ; File Access GET only SHR= ; Allow other access to go on ; while searching ; ;*** Record Access Block for SYS$SYSTEM:VMSMAIL.DAT ; VMSMAILRAB: $RAB FAB=VMSMAILFAB, - ; The File Access Block RAC=KEY, - ; Record ACcess --- keyed UBF=MAILREC, - ; User BuFfer USZ=120, - ; User buffer SiZe KRF=0, - ; Key of ReFerence (position 0) KSZ=8, - ; Key SiZe --- 8 characters KBF=KEYBUFF ; Key BuFfer ; ; MAILREC: .BLKB 120 ; VMSMAIL.DAT input buffer .ALIGN LONG .ASCII KEYBUFF: .BLKB 80 ; Username to check ; .ALIGN LONG NUM_MSG:.LONG 0 NUM_PAT: EO$ADJUST_INPUT 2 EO$MOVE 1 EO$SET_SIGNIF EO$MOVE 1 EO$BLANK_ZERO 2 EO$END CHPROMPT: .ASCII /Do you wish to set it to 0 ? / CHMSG: .ASCII / has / OUTPUT: .BYTE ^A" "[2] .ASCII / new message(s)./ ANSWER: .BLKB 5 ; LENGTH: .BLKL 1 PROMPT: .ASCII /Enter the USERNAME to change : / MSG: .ASCII / has been set to 0 new MAIL messages./ MSG2: .ASCII /No new messages -- VMSMAIL record not changed./ .ASCII MSG3: .ASCII /VMSMAIL record not changed./ INTRO: .ASCII /This program will modify SYS$SYSTEM:VMSMAIL.DAT by setting/ CRLF: .ASCII INTRO2: .ASCII /the number of new mail messages for a specified user to 0./ .ASCII TTCHAN: .BLKL 1 TTNAME: .ASCID /SYS$COMMAND/ ;**************************************************************** ; .PSECT EXE,NOWRT .ENTRY MSGFIX,^M<> ; Entry mask $ASSIGN_S - ; Assign an I/O channel to the terminal DEVNAM=TTNAME, - CHAN=TTCHAN MOVAB INTRO,R0 ; Print intro message MOVL #60,R1 ; .... BSBW PUT_OUT ; .... MOVAB INTRO2,R0 ; .... MOVL #62,R1 ; .... BSBW PUT_OUT ; .... $QIOW_S CHAN=TTCHAN, - ; Get the username to change FUNC=#IO$_READPROMPT, - P1=KEYBUFF, - P2=#80, - P4=#0, - P5=#PROMPT, - P6=#31 LOCC #CR,#80,KEYBUFF ; Find the end of the username entered SUBL2 #KEYBUFF,R1 ; Get the length of the name entered MOVL R1,LENGTH ; Save the length ; ;** Convert to uppercase ; MOVL R1,R0 ; Copy the length (loop counter) MOVAB KEYBUFF,R7 ; Copy the starting address 1$: CMPB #^X60,(R7) ; Is character >= "a" BGTR 5$ ; No - don't touch it. Yes - continue BICB2 #^B00100000,(R7) ; Convert each character to uppercase ; (turn off bit 5) 5$: INCL R7 ; Bump up pointer into OUTBUF SOBGTR R0,1$ ; Finished? No - convert next ; CMPL #8,R1 ; Is the length of the name entered > 8? BLEQU 10$ ; Yes -- go get the record MOVB R1,VMSMAILRAB+RAB$B_KSZ ; Move the length of the key to RAB 10$: $OPEN FAB=VMSMAILFAB ; Open SYSUAF.IDX for searching BLBS R0,20$ ; No error -- continue BRW ERROR ; Error -- Exit & flag it 20$: $CONNECT RAB=VMSMAILRAB ; Connect to SYSUAF ; CLRL R5 ; Clear out R5 for use as new count READIT: $GET RAB=VMSMAILRAB ; Read a record from ACTDAT CMPL #RMS$_RNF,R0 ; Was the record found? BNEQ 10$ ; No -- error BRW ERROR 10$: EXTV #33*8,#16,MAILREC,R0 ; Get the number of mail messages CMPL #0,R0 ; Are there any new messages? BNEQ 20$ ; NO -- don't change anything BRW BYE 20$: CVTLP R0,#2,NUM_MSG ; Convert the # to packed format EDITPC #2,NUM_MSG,NUM_PAT,OUTPUT ; Convert to ASCII decimal MOVAB KEYBUFF,R6 ; Get the address of the username ADDL3 LENGTH,R6,R7 ; Bump up past the username MOVC3 #27,CHMSG,(R7) ; Move the HAS X NEW MSG message SUBL3 #4,R6,R0 ; Get addr of buffer to print ADDL3 LENGTH,#32,R1 ; Get the length of string to print BSBW PUT_OUT ; Print it $QIOW_S CHAN=TTCHAN, - ; Get the answer FUNC=#IO$_READPROMPT, - P1=ANSWER, - P2=#5, - P4=#0, - P5=#CHPROMPT, - P6=#32 CMPB #^A"Y",ANSWER ; Was answer a No? BEQLU DO_IT ; Yes -- don't change it CMPB #^A"y",ANSWER ; Was answer No (lowercase)? BEQLU DO_IT ; Yes -- don't change it BRW BYE2 ; Leave it alone & Exit ; DO_IT: INSV R5,#33*8,#16,MAILREC ; Insert 0 into bits $UPDATE RAB=VMSMAILRAB ; Update the record with 0 message count BLBC R0,ERROR ; Error of some sort? ; MOVC3 #39,MSG,(R7) ; Move the message to KEYBUFF MOVAB KEYBUFF-4,R0 ; Get the address of buffer to print ADDL3 LENGTH,#44,R1 ; Get the whole length of string BSBW PUT_OUT ; Go print it $CLOSE FAB=VMSMAILFAB ; Close SYSUAF.DAT $EXIT_S ; Exit to VMS ; BYE: MOVAB MSG2,R0 ; Move NO MSG-NOT CHANGED message to R0 MOVZBL #52,R1 ; Move length to R1 BSBB PUT_OUT ; Print it BRB BYE_BYE ; Skip next msg BYE2: MOVAB MSG3,R0 ; Move NOT CHANGED msg addr to R0 MOVZBL #33,R1 ; Put length in R1 BSBB PUT_OUT ; Go print it BYE_BYE: $CLOSE FAB=VMSMAILFAB ; Close SYSUAF.DAT $EXIT_S ; Exit to VMS ; ERROR: $EXIT_S R0 ; PUT_OUT: PUSHR #^M ; Restore registers $QIOW_S CHAN=TTCHAN, - ; Write message to terminal FUNC=#IO$_WRITEVBLK, - P1=(R0), - P2=R1 POPR #^M ; Restore registers RSB ; Return ; .END MSGFIX