I am reading a report in as a STEM variable and need to pull out the date, time and the alarm name. The alarm name is on the line below it's corresponding date and time, and therefore a different record, which is making my solution a little trickier.
I've been able to get the 3 variables organized together with this:
"EXECIO * DISKR indd 1501 (FINIS STEM LogRec."
Do i=1 to LogRec.0
parse var LogRec.i . '/' date . ,
. 12 time 20 . ,
. 21 alarmname 50 .
/* allinfo = date time alarmname */
/*IF SUBSTR(alarmname,10,5) = "$ABC9" THEN
do */
say date
say time
say alarmname
/* say allinfo
end */
end
Do i=1 to LogRec.0
parse var LogRec.i . '/' date . ,
. 12 time 20 . ,
. 21 alarmname 50 .
/* allinfo = date time alarmname */
/*IF SUBSTR(alarmname,10,5) = "$ABC9" THEN
do */
say date
say time
say alarmname
/* say allinfo
end */
end
When I run the program like this (with seperate SAY statements), I get nice little packages in my output. I don't want most of them, but the ones I want look like this:
:Process $ABC9 is not running
09/25
12:00:33
¦ Alarm stopped ¦
:Process $ABC9 is now running
09/25
12:47:02
¦ First alarm ¦
The problem is (you can see the IF statement i've commented out), is that I only want the date, time and alarmsname when a certain alarm name (in this case $ABC9) appears within the alarmname string.
How can I associate the date and time variables that directly proceeded each of the alarm names?
If I uncomment the allinfo variable which concatenates the three variables, I still only get the alarmname strings; this is the closest i've come to the output I want though. I'd just like to see the date and time before each of these:
:Process $ABC9 is not running
:Process $ABC9 is now running
:Process $ABC9 is not running
:Process $ABC9 is now running
***
Here's a snippet of the report i'm reading in:
2012/09/25 11:49:22 ¦ First alarm ¦ ¦ RED ¦ ABC9 ¦ 2012/09/25 11:49:22
\Process $ABC9 is not running
2012/09/25 12:00:33 ¦ Alarm stopped ¦ ¦ INFO ¦ ABC9 ¦ 2012/09/25 11:49:22
\Process $ABC9 is now running
TIA