;**************************************************************** ;* * ;* Programmer : HUNTER GOATLEY * ;* Program : MAILMSGFIX.MAR * ;* Shop : WKU/ACRS STH 110 * ;* Purpose : To show the number of new MAIL messages * ;* System : VAX 11/785 VAX/VMS v4.1 * ;* Date : November 13, 1985 * ;* * ;**************************************************************** ;* * ;* * ;**************************************************************** ; 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$BLANK_ZERO 2 EO$MOVE 1 EO$END CHMSG: .ASCII / has / OUTPUT: .BYTE ^A" "[2] REST1: .ASCII / new message./ REST2: .ASCII / new messages./ ANSWER: .BLKB 5 ; LENGTH: .BLKL 1 PROMPT: .ASCII /Enter the USERNAME to show : / MSG2: .ASCII /No new messages./ .ASCII INTRO: .ASCII /This program will show the number of new MAIL messages for/ CRLF: .ASCII INTRO2: .ASCII /a specified user./ .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 #21,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=#29 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,R8 ; Get the number of mail messages ; CVTLP R8,#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 #7,CHMSG,(R7) ; Move the HAS X message CMPL #1,R8 ; Was there only one message? BNEQU 15$ ; Yes - move MESSAGE message MOVC3 #15,REST1,7(R7) ; .... BRB 20$ 15$: MOVC3 #16,REST2,7(R7) ; Move MESSAGES message 20$: SUBL3 #4,R6,R0 ; Get addr of buffer to print ADDL3 LENGTH,#30,R1 ; Get the length of string to print BSBW PUT_OUT ; Print it BRB BYE_BYE ; Leave it alone & Exit ; ; BYE: MOVAB MSG2,R0 ; Move NO MSG-NOT CHANGED message to R0 MOVZBL #23,R1 ; Move length to R1 BSBB PUT_OUT ; 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