find_pdlib.sh


#!/bin/ksh

if [ $# -ne 2 ]
then
    xusage
fi

typeset -u xprodline=$1
typeset -u xlibname=$2

Count=`rngdbdump -n gen prodline \
                 -f productline  \
                 -k $xprodline   | wc -l`

if [ $Count -ne 1 ]
then
    echo "\nERROR: invalid productline ($xprodline)"
    exit 1
fi

Count=`rngdbdump -n gen library \
                 -f libname     \
                 -v productline=$xprodline libname=$xlibname type=0 | wc -l`

if [ $Count -ne 1 ]
then
    echo "\nERROR. Invalid pdlib: $xlibname"
    exit 1
fi

rngdbdump -n gen pgmlib                               \
          -f productline systemcode programcode       \
          -v productline=$xprodline libname=$xlibname | sort -u

xusage()
{
    echo
    echo "\tUsage:  List all programs that use a pdlib file"
    echo "\tSyntax: `basename $0` prodline library"
    echo
    exit 1
}