I can't seem to get these script to work.  This script is the exactly like
the script on http://www.csc.foxboro.com <http://www.csc.foxboro.com> .  I
can't seem to get either to work.
Has anyone cleaned this script up?  If so could you please post it?

Thanks,
Rory Loupe


                -----Original Message-----
                From:   Johnson,Alex [mailto:[EMAIL PROTECTED]]
                Sent:   Wednesday, May 03, 2000 3:31 PM
                To:     Foxboro DCS Mail List
                Subject:        RE: Process Alarms

                HH 714 from the CSC explains this

                I've included it for your reading pleasure. Don't say I
never did anything
                for you.

                HH#:  HH714

                                                    IA INFO:  maf9506
                                                       File:  Alarm History
                                                    Release:  Prior 4.2
                                                       Date:  Aug. 14, 1995



                Subject:  Converting Alarm History to an ASCII file
                 Source:  SDE


                Problem Analysis: 

                Alarm history data is not easily accessible.  When the
historian
                is turned off the data is saved to
/usr/hstorian/almhist.bak. 
                This file is written over every time the historian is turned
off.
                To be able to convert almhist to an ascii file that can be
                manipulated would be helpful.

                Problem Workaround: 

                "almhist" file is a data file with a fixed length record of
160
                bytes.  There is no carriage return or line feed in the
file,
                that explains why "pr", "lp" and "cat" do not work for this
file.
                The following script is to dump this file to ascii format
with
                proper line feed and carriage return and headings.
                       
                Since almhist is a circular file, one has to find where is
the
                logical time start and print from there to the end and then
from
                line 1 to the logical time start point in the file. The
final
                output is going to "almhist.txt" file.
                      
                For Venix platforms, AP20/PW, the output file almhist.txt is
in
                directory /usr/tmp.  For Sun platform 50/51 series, the
output
                file almhist.txt is in the /opt/fox directory.

                Problem Action: 
                      
                The Historian Data Display will have the ability to view
Alarm
                History and output the data to a file or printer. This
product
                improvement estimated implementation release is V4.2.

                       :
                       #set -x
                       ALMHIST=/usr/hstorian/almhist
                       #
                       #  Find out if we are running on Venix, SunOS or
Solaris (SVR4)
                       #  to use awk or nawk or correct path for bpatch.
                       #
                       if [ -f /vrtx ]
                       then
                          echo "  -=- Venix OS -=-"
                          BPATCH=/usr/foxbin/bpatch
                          AWK=/usr/bin/awk        
                          TMPFILE=/usr/tmp/almhist.tmp
                          TXTFILE=/usr/tmp/almhist.txt
                       else
                          if  test -f  /etc/fox/ia_opsys \
                          &&  test `awk '{print $1}' /etc/fox/ia_opsys` = 1
                          then
                             echo "  -=- 51 Series OS -=-"
                             BPATCH=/usr/fox/disp_tools/bpatch
                             AWK=/usr/bin/nawk        
                             TMPFILE=/opt/fox/almhist.tmp
                             TXTFILE=/opt/fox/almhist.txt
                          else
                             echo "  -=- 50 Series OS -=-"
                             BPATCH=/usr/fox/disp_tools/bpatch
                             AWK=/usr/bin/awk        
                             TMPFILE=/opt/fox/almhist.tmp
                             TXTFILE=/opt/fox/almhist.txt
                          fi
                        fi

                        rm -f $TMPFILE
                        rm -f $TXTFILE

                        $BPATCH -d $ALMHIST > $TMPFILE

                        $AWK 'BEGIN { print "                    ALARM
HISTORY\n"

                        print "COMPOUND:BLOCK.POINT.................. 
                BLOCK-DESCRIPTOR...............PRI ALARM"
                        print "MM-DD HH:MM:SS vvvvvvvvv uuuuuu (vvvvvvvvv) 
                OPTIONAL-MESSAGE...................\n"

                          line = 1 }
                        { if( FILENAME == "/usr/pub/ascii" )
                          {
                             i=1;
                             if( length($1) != 1 )   continue;
                             while( i 10 )
                               {
                                  for( i=2; i<=17; i++ )
                                  {
                                    printf "%s", ascii[$i]
                                  if( ( i == 10 ) && (line % 5) == 0 &&
(line %10) != 0 )
                                    {
                                       printf " "
                                    }
                                  }
                                  if( ((line % 5) == 0 ) && ((line % 10) !=
0) )
                                  {
                                    printf "\n"
                                  }
                                  if( (line % 10) == 0 )
                                  {
                                    printf "\n"
                                  }
                               }
                               line++
                               continue
                            }  
                          }
                        }' /usr/pub/ascii $TMPFILE >$TXTFILE
                        rm -f $TMPFILE
                        #
                        # since this is a circular buffer - find out where
to begin.
                        #

                        awk ' BEGIN { oldest_str = "20-50 25:61:61" }
                              { for(i=1;i<NF; if( { ) ~ else } $TXTFILE }'
?%d\n",linenum-1
                printf END linenum = NR; oldest_str temp
                        linenum=`cat temp`
                        #echo $linenum
                        awk '{ printf "%d\n", $1 - 1 }' temp > temp2
                        endline=`cat temp2`
                        #echo $endline
                        rm -f temp        
                        rm -f temp2       
                        sed -n 1,5\p $TXTFILE >$TMPFILE
                        sed -n $linenum,\$p $TXTFILE >>$TMPFILE
                        sed -n 6,$endline\p $TXTFILE >>$TMPFILE
                        cp $TMPFILE $TXTFILE
                        rm -f $TMPFILE








                                                HH714

                Regards,

                Alex Johnson
                The Foxboro Company
                10707 Haddington
                Houston, TX 77043
                713.722.2859 (v)
                713.722.2700 (sb)
                713.932.0222 (f)
                [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 


                        -----Original Message-----
                        From:   Clement, Mark
[SMTP:[EMAIL PROTECTED]]
                        Sent:   Wednesday, May 03, 2000 1:31 PM
                        To:     'Foxboro DCS Mail List'
                        Subject:        RE: Process Alarms

                        Alex

                        Could you elaborate on point #1 in the after options
?
                        What tool/utility would that be to dump the FIFO
queue ?

                        Thanks for your help
                        Mark

                        -----Original Message-----
                        From: Johnson,Alex [mailto:[EMAIL PROTECTED]]
                        Sent: Tuesday, May 02, 2000 2:48 PM
                        To: Foxboro DCS Mail List
                        Subject: RE: Process Alarms


                        Frankly, the best way to do this is one of the
following:

                        1)      Add FoxAMI to your system and store the
messages there
                        2)      Use a PC as your "alarm printer" and one of
several 3rd
                party
                        packages to capture the alarms.

                        After that the options are worse,

                        1)      The I/A Series Historian maintains a FIFO
queue of 5000
                        alarms/messages. There is a tool to dump this file,
but it is really
                a
                        pretty worthless archive.
                        2)      AIM*Historian can record the messages, but
it does not have
                a GUI to
                        dump the data or a command line tool; you will have
to write them or
                use MS
                        tools on a PC.


                        Regards,

                        Alex Johnson
                        The Foxboro Company
                        10707 Haddington
                        Houston, TX 77043
                        713.722.2859 (v)
                        713.722.2700 (sb)
                        713.932.0222 (f)
                        [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 


                                -----Original Message-----
                                From:   Clement, Mark
                [SMTP:[EMAIL PROTECTED]]
                                Sent:   Tuesday, May 02, 2000 1:08 PM
                                To:
'[EMAIL PROTECTED]'
                                Subject:        Process Alarms

                                Hi all

                                Has anyone done any work(or have examples)
of extracting
                process
                        alarms from
                                I/A and converting to text type file ? 
                                Do they reside in the historian or informix
or some other
                file
                        system ?

                                Thanks In Advance 
                                Mark

                                

-----------------------------------------------------------------------
This list is neither sponsored nor endorsed by the Foxboro Company. All 
postings from this list are the work of list subscribers and no warranty 
is made or implied as to the accuracy of any information disseminated 
through this medium. By subscribing to this list you agree to hold the 
list sponsor(s) blameless for any and all mishaps which might occur due to 
your application of information received from this mailing list.

To be removed from this list, send mail to 
[EMAIL PROTECTED] 
with "unsubscribe foxboro" in the Subject. Or, send any mail to
[EMAIL PROTECTED]

Reply via email to