.TITLE TEST_SYSTEM_DUMP tests SYSDUMP.DMP file status .IDENT /V2.0/ ;++ ; FACILITY: ; Automated System Dump File Analysis and Save batch job. ; ; ABSTRACT: ; This program will read the Dump Header block from the system ; dump file (SYS$SYSTEM:SYSDUMP.DMP) and return a status indicating ; whether it should be saved or not. ; ; ENVIRONMENT: ; Native user mode program RUN from DCL. ; ;-- ; ; MODIFICATION HISTORY: ; ; AUTHOR: F. Nagy Creation date: 28-Jul-81 ; ; V1.1 29-Jul-81 FJN Added check on Bugcheck word for ; Operator requested shutdown. ; V1.2 21-Aug-82 FJN Fix PIC problem when preparing version for ; VMS V3.0 ; V2.0 23-Aug-82 FJN Not working for V3, handle Crash and Bugcheck ; EMB's separately; Fix V3 addressing of EMB ; ; ; Assembly and Linking Instructions: ; ; MACRO TSTSYSDMP+SYS$LIBRARY:LIB/LIBRARY ; LINK TSTSYSDMP+SYS$SYSTEM:SYS.STB/SELECT ; .PAGE .SUBTITLE Declarations ; ; LIBRARY MACROS: ; .NOCROSS $DMPDEF ;System dump file header block $EMBETDEF ;Error Message Block event types $EMBHDDEF ;Error Message Block header offsets $EMBBCDEF ;BUGCHECK Error Message Block offsets $EMBCRDEF ;CRASH Error Message Block offsets $STSDEF ;Status condition code fields $SSDEF ;System service code definitions .CROSS ; ; LOCAL MACROS: ; ; NONE ; ; EQUATED SYMBOLS: ; blk_size = 512 ;Size of a disk block in bytes .PAGE .SUBTITLE Impure data storage ; ; IMPURE LOCAL STORAGE: ; .PSECT IMPURE_DATA,LONG,NOEXE,WRT ; ; RMS control blocks ; DMPFAB: $FAB FNM=,- ;File access block for dump file FAC=,- ;Will only read the dump header block SHR=GET DMPRAB: $RAB FAB=DMPFAB,- ;Will read the first virtual block only ROP=BIO,BKT=0,- UBF=DUMP_HEADER,- ;Into dump header buffer USZ=BLK_SIZE .ALIGN LONG ; ; Buffer to hold the Dump Header block ; DUMP_HEADER: .BLKB BLK_SIZE ;Single disk virtual block .PAGE .SUBTITLE Main program code .PSECT CODE,LONG,EXE,NOWRT ;++ ; FUNCTIONAL DESCRIPTION: ; This program will read the Dump Header block from the system dump ; file (SYS$SYSTEM:SYSDUMP.DMP) and return a status indicating if ; (a) the dump file has been analyzed, or ; (b) the dump file was written when the operator requested a ; system shutdown, or ; (c) the dump file was written due to a hardware or software ; failure. ; Normally, the case (c) will cause the system dump file to be run ; through SDA (analyzed) and to be saved on the SYSDMP tape by the ; SYSDMPJOB batch job submitted in the startup procedure. ; ; CALLING SEQUENCE: ; RUN TSTSYSDMP ; ; INPUT PARAMETERS: ; Dump header block (virtual block 1) of SYS$SYSTEM:SYSDUMP.DMP file. ; ; CONDITION CODES: ; SS$_NORMAL - returned if the system dump file has already been ; analyzed by SDA. ; BUG$_OPERATOR - returned (with INFO severify) if the system was ; shutdown at operator request. ; other - returned (with ERROR severity) if the system dump was ; written due to a hardware or software crash. ; ;-- TSTSYSDMP:: .WORD ^M $OPEN FAB=DMPFAB ;Open the system dump file BLBS R0,10$ ;Check for any errors BRW FABERROR ;Signal the error 10$: $CONNECT RAB=DMPRAB ;Connect the record stream BLBS R0,20$ ;Check for any errors BRW RABERROR ;Signal the error 20$: $READ RAB=DMPRAB ;Read the first virtual block of the file BLBS R0,30$ BRW RABERROR 30$: $CLOSE FAB=DMPFAB ;Done, close the file BLBS R0,40$ ;Check for any errors BRW FABERROR 40$: MOVZWL #SS$_NORMAL,R0 ;Initialize return status to analyzed MOVAB DUMP_HEADER,R1 ;Get address of Dump Header buffer BBS #DMP$V_OLDDUMP,- ;Has the dump been analyzed? DMP$W_FLAGS(R1),EXIT ; If so exit with success status MOVAB DMP$L_CRASHERL+4(R1),R2 ;Pointer to Crash error log buffer CMPW EMB$W_HD_ENTRY(R2),- ;Check Error Message Buffer entry type #EMB$K_CR ; against code for CRASH BEQL 50$ ;If so, then get crash condition code BICL3 #STS$M_SEVERITY,- ;Else get BUGCHECK condition code EMB$L_BC_CODE(R2),R3 ; without the severity bits BRB 60$ ; 50$: BICL3 #STS$M_SEVERITY,- ;Clear severity bits in the EMB$L_CR_CODE(R2),R3 ; crash condition code value 60$: BISL3 #STS$K_ERROR,R3,R0 ;Set return status for ERROR BICL2 #^CSTS$M_COND_ID,R3 ;Save just the condition identification CMPL R3,- ;Did the operator request a shutdown? #BUG$_OPERATOR&STS$M_COND_ID BNEQ EXIT ;If not, then exit with ERROR status BISL2 #STS$K_INFO,R0 ;Yes, exit with INFORMATIONAL status EXIT: RET ;Exit program back to system with the ; condition code in R0 ; ; Handle RMS errors by signaling and returning them as the final status ; FABERROR: ;RMS status is in File Access Block PUSHL FAB$L_STV+DMPFAB ;Secondary RMS status from FAB PUSHL R0 ;RMS condition value CALLS #2,G^LIB$STOP ;Signal error and exit RABERROR: ;RMS status is in Record Access Block PUSHL RAB$L_STV+DMPRAB ;Secondary RMS status from RAB PUSHL R0 ;RMS condition value CALLS #2,G^LIB$STOP ;Signal error and exit .END TSTSYSDMP