#!/bin/ksh
#
#
#
#set -x
if [ $# -lt 2 ]; then
print " "
print " Usage: To get information about programs that
use a library"
print " Syntax: pdlibinfo [-q] ProductLine PDlibraryname"
print " q - Build qcompile statements for each program"
print " Example: pdlibinfo prod oeoil"
print " pdlibinfo -q prod oecor"
print " "
exit 1
fi
if [ $1 = "-q" ] || [ $1 = "q" ]; then
productline=`echo $2 | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
libname=`echo $3 | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
else
productline=`echo $1 | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
libname=`echo $2 | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
fi
rngdbdump gen library -f systemcode libname type -v productline="$productline"
libname="$libname" 2> /dev/null | tail -1 >
~/libraryx
libtype=`awk '{print $3}' ~/libraryx`
if [ $libtype = 1 ] || [ "$libtype" = ""
]; then
print "Error. PDlibraryname not a library or not a PDlibrary"
exit 1
fi
systemcode=`awk '{print $1}' ~/libraryx`
#echo ProductLine = $productline
#echo SystemCode = $systemcode
#echo LibName = $libname
if [ $1 = "-q" ] || [ $1 = "q" ]; then
rngdbdump -cn gen pgmlib -f systemcode programcode -v productline="$productline"
libname="$libname" 2> /dev/null | awk -F\, '{printf
"qcompile %s %s %s\n", productline, $1, $2}' productline=$productline
| sed -e 's/\"//g' | sort -u > ~/pgmlibx 2> /dev/null
cat ~/pgmlibx
else
# rngdbdump -cn gen pgmlib -f systemcode programcode -v productline="$productline"
libname="$libname" 2> /dev/null | awk -F\, '{printf
" %s %s\n", $1, $2}' | sed -e 's/\"//g' | sort
-u > ~/pgmlibx
rngdbdump -cn gen pgmlib -f systemcode programcode -v productline="$productline"
libname="$libname" 2> /dev/null | awk -F\, '{printf
"rngdbdump -cn gen program -f systemcode programcode
programname -v productline=%s systemcode=%s programcode=%s
2> /dev/null\n", productline, $1, $2}' productline=$productline
| sed 's/\"//g' | sort -u > ~/pgmlibx
print " "
print "The following programs are affected by any change
to the library $libname:"
print " "
. ~/pgmlibx > ~/programsx
print "System Code Program Code Program Name"
print "=========== ============ =============================="
cat ~/programsx | sed 's/\"//g' | awk -F\, '{printf "
%-2s %-5s %s\n", $1, $2, $3}'
fi
rm ~/libraryx
rm ~/pgmlibx
exit 0
|