# Title: run_file_copy_validation_biodev.sh
# Description: This script Validate the Source files and run the informatica job scripts.
#
# Parameter Required: No
# Parameter(s)
#
# Author: Ravivarma
# Date: 09/10/2014
# Version: 1.0
#
export RUNDIR=/home/bioddev/scripts/shell
. ${RUNDIR}/run_envsetup_biogen.sh
##############################################################################
### PROCESS STARTS HERE ###
##############################################################################
export LOGFILE=${g_LOGDIR}/run_file_copy_validation_biogen.sh.`date '+%d.%b.%Y.%Hh%Mm%Ss'`
### LOG FILE CREATE CHECK
echo 'Process Started @' `date` $'\n' > ${LOGFILE}
STATUS=$?
if [ $STATUS -ne 0 ]; then
echo 'Unable to Create LOG File ' $'\n' | tee -a ${LOGFILE}
gF_SendEmail F ${p_WorkFlowID} ${LOGFILE}
return 99
fi
###############################################################################
### Execute the PYTHON script to process the XLSX files #####
###############################################################################
`./xlsx2csv.py -d "," -f %m/%d/%Y -i -s 1 /home/bioddev/dev/inbound/legacy/load/LND_PPV_DEMO_CMID_XREF.xlsx /home/bioddev/dev/inbound/legacy/load/LND_PPV_DEMO_CMID_XREF.txt`
`./xls2csv.py -d "," -f %m/%d/%Y -i -s 1 /home/bioddev/dev/inbound/legacy/load/LND_CMOP_DISPENSE.xls /home/bioddev/dev/inbound/legacy/load/LND_CMOP_DISPENSE$*.txt`
`./xlsx2csv.py -d "," -f %m/%d/%Y -i -s 1 /home/bioddev/dev/inbound/legacy/load/biog1401.xlsx /home/bioddev/dev/inbound/legacy/load/biog1401.txt`
l_processed_file_list=${g_HOME}/processed_files_list.lst
l_success_file_list=${g_HOME}/sucess_files_list.lst
l_failed_file_list=${g_HOME}/failed_files_list.lst
> ${l_success_file_list}
> ${l_failed_file_list}
> ${l_processed_file_list}
gF_FileDetails
for l_file_string in ${g_File_Details}
do
l_filename=`basename ${l_file_string}`
g_File_columns ${l_filename}
l_file_no_of_columns= ${g_col_count}
## Check if the file was successfully processed before. Continue if the load status was Fail or the file was never processed
l_Failed_Flag="N"
g_FileProcessedCheck `basename ${l_file_name}`
if [ "${g_ProcStat}" = "Y" ]; then
echo 'File already processed' $'\n' | tee -a ${LOGFILE}
echo ${l_file_name} >> ${l_processed_file_list}
else
if [ "${l_col_check_flg}" = 'Y' ];then
gF_NumOfColumnCheck ${l_file_name} ${l_no_of_columns} 'run_file_copy_validation.sh'
if [ "${g_ColCheckFailFlg}" = "Y" ]; then
l_Failed_Flag="Y"
echo 'Filename: ' ${l_file_name} | tee -a ${LOGFILE}
echo 'Failure Reason: Incorrect no of columns in the record(s)' $'\n' | tee -a ${LOGFILE}
g_InsertFileQCStatus `basename ${l_file_name}` 'NOCOL' 0 ${g_FileRecCount} 0 'INVALID COLUMNS' 'run_file_copy_validation.sh' ${Spp_Key}
fi
fi
if [ "${l_Failed_Flag}" = "Y" ]; then
echo ${l_file_name} >> ${l_failed_file_list}
echo ${l_file_name} >> ${l_failed_file_name}
g_InsertFileLoadStatus ${l_file_name} ${l_row_count} 'F' 'run_file_copy_validation.sh' ${Spp_Key}
else
echo ${l_file_name} >> ${l_spool_file_name}
echo ${l_file_name} >> ${l_success_file_list}
echo 'Successfully Validated the file ' ${l_file_name} $'\n' | tee -a ${LOGFILE}
g_InsertFileLoadStatus ${l_file_name} ${l_row_count} 'S' 'run_file_copy_validation.sh' ${Spp_Key}
fi
done
ArchiveFile ${l_file_name}
. ${RUNDIR}/run_landing_legacy_file_load.sh
. ${RUNDIR}/run_staging_legacyload.sh
if [ $g_STATUS -ne 0 ]; then
echo 'Workflow Execution Status: FAILED' $'\n' | tee -a ${LOGFILE}
echo ${l_load_file_name} >> ${g_PROCDIR}/${g_FailListFile}
else
. ${RUNDIR}/run_ods_legacyload.sh
echo 'Workflow Execution Status: SUCCESS' $'\n' | tee -a ${LOGFILE}
echo ${l_load_file_name} >> ${g_PROCDIR}/${g_SuccessListFile}
fi
echo 'List of Success Files' $'\n' | tee -a ${LOGFILE}
cat ${l_success_file_list} | tee -a ${LOGFILE}
echo | tee -a ${LOGFILE}
echo 'List of Failure Files' $'\n' | tee -a ${LOGFILE}
cat ${l_failed_file_list} | tee -a ${LOGFILE}
echo | tee -a ${LOGFILE}
echo 'List of Already Processed Files' $'\n' | tee -a ${LOGFILE}
cat ${l_processed_file_list} | tee -a ${LOGFILE}
echo | tee -a ${LOGFILE}
gF_SendEmail F W ${p_WorkFlowID} ${LOGFILE}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.