//////////////////////////////////////////////////////////////////////////// // // A sample task for parsing SYS:SYSTEM\SYS$LOG.ERR checking for Errors with // a Severity greater than 1 (0 = Informational, 1 = Warning) which are not // TTS or shutdown related. This could be used to summarize important // system error log entries before clearing the log file. // //////////////////////////////////////////////////////////////////////////// // // Variables used: // // %0 : Used to retrieve data from SYS:SYSTEM\SYS$LOG.ERR // %1 : Used to retrieve data from SYS:SYSTEM\SYS$LOG.ERR // //////////////////////////////////////////////////////////////////////////// // OPEN the input log file to READ OPEN_READ SYS:SYSTEM\SYS$LOG.ERR // OPEN the output log file to WRITE OPEN_WRITE SYS:SYSTEM\SYS$LOG.DAT TRUNCATE WHILE // Read the next line in the error log file (ERRORLEVEL = EOF) READ %0 IF ERRORLEVEL THEN BREAK // Scan the READ string for Server or DS error entry IF SCAN_STRING "SERVER-" "%0" OR SCAN_STRING "DS-" "%0" // READ the next line in the error log file (ERRORLEVEL = EOF) READ %1 IF ERRORLEVEL THEN BREAK // If %1 is NULL, end of entry IF "%1"=="" THEN BREAK // Scan the READ string for 'Severity =' // (not a valid error message if not present) IF NOT SCAN_STRING "Severity =" "%1" THEN CONTINUE // Scan the READ string for Informational (Severity = 0) or // Warning (Severity = 0) messages IF SCAN_STRING "Severity = 0" "%1" OR SCAN_STRING "Severity = 1" "%1" CONTINUE ENDIF // Scan the READ string for TTS (Locus = 7) and Shutdown (Class=19) messages IF SCAN_STRING "Locus = 7" "%1" AND SCAN_STRING "Class = 19" "%1" CONTINUE ENDIF // WRITE Date/Time SERVER- error line since Severity is not equal 0 or 1 WRITE %0 // Use WHILE/LOOP to write pertinent error lines to new log WHILE // WRITE last line READ WRITE %1 // If %1 is NULL, end of entry IF "%1"=="" THEN BREAK // READ the next line in the error log file (ERRORLEVEL = EOF) READ %1 IF ERRORLEVEL THEN BREAK LOOP ENDIF LOOP // Processing complete so CLOSE all the log files (OPEN_READ and OPEN_WRITE) CLOSE