Humble Trader

Monday, March 13, 2006

run_PF_D_TIME.sh

#!/bin/bash
# ########################################################################### #
# #
# Title: run_PF_D_TIME.sh #
# Author: Steve Roach #
# Date: 12-MAR-2006 #
# Version: 01.00 #
# #
# Description: Runs the Process Flow PF_D_TIME. #
# #
# Parameters: start_date - The earliest date that D_TIME is to be #
# populated with. #
# end_date - The latest date that D_TIME is to be populated #
# with. #
# log_file_flag - If 'Y' then write all output to the log file #
# $DW_LOGS/run_PF_D_TIME.sh.[date] where the date format is; #
# 'YYYYMMDD.HHMISS', otherwise, write all output to STDOUT. #
# #
# Environment: The environmental variable WHS_WBA_PWD contains the password #
# for the Oracle account; wba@whs. #
# The environmental variable DW_LOGS contains the log directory #
# path. #
# #
# History: #
# #
# Date Ver Author Description #
# --------- ----- ------ ---------------------------------------------------- #
# 12-MAR-06 01.00 SRR First release #
# #
# ########################################################################### #

usage()
{
echo
echo "usage $(basename $0) start_date end_date log_file_flag"
}

if [ "$1" = "" ]
then
usage
echo
echo "start_date missing."
echo
exit 1
fi

start_date=$1

if [ "$2" = "" ]
then
usage
echo
echo "end_date missing."
echo
exit 1
fi

end_date=$2

if [ "$3" = "Y" -o "$3" = "y" ]
then
log_file=$DW_LOGS/run_PF_D_TIME.sh.`date '+%Y%m%d.%H%M%S'`

sqlplus wba/$WHS_WBA_PWD@whs @sqlplus_exec_template.sql wbr OWF
PROCESS PF_D_TIME "," "P_START_DATE=$start_date,P_END_DATE=$end_date"
&> $log_file
else
sqlplus wba/$WHS_WBA_PWD@whs @sqlplus_exec_template.sql wbr OWF PROCESS
PF_D_TIME "," "P_START_DATE=$start_date,P_END_DATE=$end_date" 2>&1
fi

exit 0

0 Comments:

Post a Comment

<< Home