#!/bin/ksh ############################################################################ # cmp_lib.sh - Compile (or list) all programms associated to a given library # Ted Schreckenghost ############################################################################ usage () { echo echo " Usage: To compile programs a PD library uses" echo "Syntax: `basename $0` {ProdLine} {Library} [-l,-d,-s {Sys}]" echo " -l List only - no compile" echo " -d Compile with debug (default is WITHOUT)" echo " -s Only compile {Sys} system code" echo } if [ $# = 0 ] then usage exit 1 else PRODLINE=`echo $1|tr "[a-z]" "[A-Z]"` LIBNAME=`echo $2|tr "[a-z]" "[A-Z]"` fi if [ $# -gt 2 ] then if [ $3 = "-s" ] then SYSTEMCODE=`echo $4|tr "[a-z]" "[A-Z]"` rngdbdump -nt -iPLBSET2 gen pgmlib -f SystemCode ProgramCode ScrNbr -k $PRODLINE $LIBNAME $SYSTEMCODE | awk '{ {SYS=$1} {PGM=$2} if ($3 == " " || $3 == "0" || $3 == "1") {COMPILE="compile"} if ($3 == "2" || $3 == "3" || $3 == "4" || $3 == "5" || $3 == "6" || $3 == "7" || $3 == "8" || $3 == "9") {COMPILE=" "} printf"%s %s %s \n", SYS, PGM, COMPILE }' > /tmp/$$.tmp else rngdbdump -nt -iPLBSET2 gen pgmlib -f SystemCode ProgramCode ScrNbr -k $PRODLINE $LIBNAME | awk '{ {SYS=$1} {PGM=$2} if ($3 == " " || $3 == "0" || $3 == "1") {COMPILE="compile"} if ($3 == "2" || $3 == "3" || $3 == "4" || $3 == "5" || $3 == "6" || $3 == "7" || $3 == "8" || $3 == "9") {COMPILE=" "} printf"%s %s %s \n", SYS, PGM, COMPILE }' > /tmp/$$.tmp fi else rngdbdump -nt -iPLBSET2 gen pgmlib -f SystemCode ProgramCode ScrNbr -k $PRODLINE $LIBNAME | awk '{ {SYS=$1} {PGM=$2} if ($3 == " " || $3 == "0" || $3 == "1") {COMPILE="compile"} if ($3 == "2" || $3 == "3" || $3 == "4" || $3 == "5" || $3 == "6" || $3 == "7" || $3 == "8" || $3 == "9") {COMPILE=" "} printf"%s %s %s \n", SYS, PGM, COMPILE }' > /tmp/$$.tmp fi for i in `grep compile /tmp/$$.tmp | cut -c1-8 | sed 's/\ //g'` do if [ $# = 2 ] then qcompile $PRODLINE `echo $i|cut -c1-2` `echo $i|cut -c3-` else if [ $3 = "-d" -o $3 = "-s" ] then qcompile -D $PRODLINE `echo $i|cut -c1-2` `echo $i|cut -c3-` else if [ $3 = "-l" ] then echo `echo $i | cut -c1-2` `echo $i | cut -c3-` else usage exit 1 fi fi fi done rm -f /tmp/$$.tmp