{ last2_20.ace This is a compilable script to generate a System Alarm Messages report. for the last 2 days on an AP20. Initial version developed 09Jun95, by Angel Corbera } database hist01 { Historian Name } end DEFINE variable cday smallint {current day} variable pday smallint {previous day} variable cmonth smallint {current month} variable pmonth smallint {previous month} variable dia smallint {day} variable mes smallint {month} END output report to "/usr/ac/last2.out" left margin 0 top margin 0 bottom margin 0 end select time_tag, msg_key, station, src_name, text from sysmonmsg order by msg_key desc end format FIRST PAGE HEADER LET cday = DAY(TODAY) LET cmonth = MONTH(TODAY) LET pday = cday - 1 IF cday=1 AND cmonth=1 THEN LET pday=31 IF cday=1 AND cmonth=2 THEN LET pday=31 IF cday=1 AND cmonth=3 THEN LET pday=28 IF cday=1 AND cmonth=4 THEN LET pday=31 IF cday=1 AND cmonth=5 THEN LET pday=30 IF cday=1 AND cmonth=6 THEN LET pday=31 IF cday=1 AND cmonth=7 THEN LET pday=30 IF cday=1 AND cmonth=8 THEN LET pday=31 IF cday=1 AND cmonth=9 THEN LET pday=31 IF cday=1 AND cmonth=10 THEN LET pday=30 IF cday=1 AND cmonth=11 THEN LET pday=31 IF cday=1 AND cmonth=12 THEN LET pday=30 LET pmonth = cmonth - 1 IF cmonth = 1 THEN LET pmonth = 12 print "THE FOLLOWING REPORT IS FOR THE SM SYSTEM (Last 2 days ONLY)" print print "HOY =", cday print "AYER =", pday print on every row IF time_tag[9,10] = "01" THEN LET dia = 1 IF time_tag[9,10] = "02" THEN LET dia = 2 IF time_tag[9,10] = "03" THEN LET dia = 3 IF time_tag[9,10] = "04" THEN LET dia = 4 IF time_tag[9,10] = "05" THEN LET dia = 5 IF time_tag[9,10] = "06" THEN LET dia = 6 IF time_tag[9,10] = "07" THEN LET dia = 7 IF time_tag[9,10] = "08" THEN LET dia = 8 IF time_tag[9,10] = "09" THEN LET dia = 9 IF time_tag[9,10] = "10" THEN LET dia = 10 IF time_tag[9,10] = "11" THEN LET dia = 11 IF time_tag[9,10] = "12" THEN LET dia = 12 IF time_tag[9,10] = "13" THEN LET dia = 13 IF time_tag[9,10] = "14" THEN LET dia = 14 IF time_tag[9,10] = "15" THEN LET dia = 15 IF time_tag[9,10] = "16" THEN LET dia = 16 IF time_tag[9,10] = "17" THEN LET dia = 17 IF time_tag[9,10] = "18" THEN LET dia = 18 IF time_tag[9,10] = "19" THEN LET dia = 19 IF time_tag[9,10] = "20" THEN LET dia = 20 IF time_tag[9,10] = "21" THEN LET dia = 21 IF time_tag[9,10] = "22" THEN LET dia = 22 IF time_tag[9,10] = "23" THEN LET dia = 23 IF time_tag[9,10] = "24" THEN LET dia = 24 IF time_tag[9,10] = "25" THEN LET dia = 25 IF time_tag[9,10] = "26" THEN LET dia = 26 IF time_tag[9,10] = "27" THEN LET dia = 27 IF time_tag[9,10] = "28" THEN LET dia = 28 IF time_tag[9,10] = "29" THEN LET dia = 29 IF time_tag[9,10] = "30" THEN LET dia = 30 IF time_tag[9,10] = "31" THEN LET dia = 31 IF time_tag[6,7] = "01" THEN LET mes = 1 IF time_tag[6,7] = "02" THEN LET mes = 2 IF time_tag[6,7] = "03" THEN LET mes = 3 IF time_tag[6,7] = "04" THEN LET mes = 4 IF time_tag[6,7] = "05" THEN LET mes = 5 IF time_tag[6,7] = "06" THEN LET mes = 6 IF time_tag[6,7] = "07" THEN LET mes = 7 IF time_tag[6,7] = "08" THEN LET mes = 8 IF time_tag[6,7] = "09" THEN LET mes = 9 IF time_tag[6,7] = "10" THEN LET mes = 10 IF time_tag[6,7] = "11" THEN LET mes = 11 IF time_tag[6,7] = "12" THEN LET mes = 12 IF (dia = cday AND mes = cmonth) OR (dia = pday AND mes = cmonth) OR (cday = 1 AND dia = pday AND mes = pmonth) THEN BEGIN print column 1, time_tag[12,19] clipped, column 10, time_tag[9,10] clipped, column 12, "/", column 13, time_tag[6,7] clipped, column 15, "/", column 16, time_tag[3,4] clipped, column 23, station clipped, column 35, src_name print column 5, text print END end