#!/bin/sh
#
# get_dbv
#
# Usage: get_dbv
#
# By: Angel Corbera, TSID1, Refinery Isla, Curacao, N.A.
#
# Purpose: Create a Control Blocks database from Checkpoint files
# residing on the CPs host.
# Database format:
# CP - CMPD - BLOCK
# Note: ECB blocks are included.
#
cd /opt/ac
rm *.tmp PLANT.dbv > /dev/null 2>&1
touch PLANT.dbv
CPS=`sort /etc/cplns`
cd /usr/fox/sp/files
for x in $CPS
do
echo "Retrieving data from Checkpoint (.UC) files for $x ... \c"
/opt/fox/bin/tools/dbvu -p DB$x.UC > /opt/ac/$x.tmp
echo "Done!"
done
cd /opt/ac
for x in $CPS
do
echo "Formatting output for $x ... \c"
awk ' $1~/[A-Z0-9]+:[A-Z0-9]+/ {print $1}' $x.tmp > tmp1
awk -F: ' BEGIN { a="'$x'" }
{ printf "%-8s %-14s %-14s\n",a,$1,$2 }
' tmp1 >> PLANT.dbv
echo "Done!"
done
N=`wc -l PLANT.dbv | awk '{print $1}'`
echo "\nPLANT.dbv ($N blocks) is ready!\n"
rm *.tmp tmp1