#!/usr/bin/ksh
#whatcompile_pll ()
#------------------------------------------------------------------------------#
#    Module Name:  whatcompile_pll  (c) Copyright May 2012                     #
#                                                                              #
#    Purpose:      Recompile Oracle E-Business 12.1 PLL (Program Link Library) #
#                  Launch/Execute this Function/Script from the AppsTier.      #
#                                                                              #
#    Maintenance                                                               #
#    Date          Author        Description                                   #
#    -----------   ------------  --------------------------------------------  #
#    10-May-2012   M.Barone      Module design/creation                        #
#------------------------------------------------------------------------------#
{
        DIRNAM=$(dirname $0)
        ORASID=$(echo $CONTEXT_NAME | cut -f1 -d'_')
        HNAME=$(uname -n)

        #----------------------------------------------------------------------#
        #  TEST:  Number ($#) of arguments passed to this function?            #
        #----------------------------------------------------------------------#
        if      [ $# = 0 ]
        then
            clear
            echo 
            echo  " #--------------------------------------------------------#"
            echo  " # whatcompile_pll:                                       #"
            echo  " #--------------------------------------------------------#"
            echo                                                               

            #------------------------------------------------------------------#
            #  Trap:  Set CNTL-C CNTL-D CNTL-\ Before Password Protection      #
            #------------------------------------------------------------------#
            trap        "stty echo; return"     2                              
            trap        "stty echo; return"     3
            stty -echo

            read PASSWD?" Please Enter the Oracle APPS Passwd:  "

            stty echo
            echo 
            #------------------------------------------------------------------#
            #  Trap:  Reset CNTL-C CNTL-D CNTL-\ After Password Protection     #
            #------------------------------------------------------------------#
            trap        2
            trap        3

            read FRMNAM?"        Enter the Oracle PLL-Name [ex. CUSTOM]: "
            clear
        else
            PASSWD=$1
            FRMNAM=$2
            DIRNAM=$3
            clear
        fi

#------------------------------------------------------------------------------#
#  Initialize                                                                  #
#------------------------------------------------------------------------------#

#------------------------------------------------------------------------------#
#  SQL*Plus ("Here-Document")                                                  #
#------------------------------------------------------------------------------#
echo  "AppsTier Connection"
echo

$ORACLE_HOME/bin/frmcmp_batch userid=APPS/$PASSWD \
module=$AU_TOP/resource/${FRMNAM}.pll \
output_file=${AU_TOP}/resource/${FRMNAM}.plx \
module_type=library batch=no compile_all=special


print
ls -l  ${AU_TOP}/resource/${FRMNAM}.pll
ls -l  ${AU_TOP}/resource/${FRMNAM}.plx
print
}