Informatica 7.1:How to validate multiple mappings in one shot....Unix Shell Script
In my previous post the I have described the problem while validating multiple mappings.
Here is the script to find out which mappings are valid and whcih are invalid....
##########################################################################################################
# Script: This is the wrapper script to collect invalid objetcs at one shot of informatica. #
# Author: M.A.Hasim
# Modification:
# Modification
# History: 11-16-2006-- INTIAL VERSION
# Calling: fetch_object_map_v1.sql
# Called By: None
##########################################################################################################
. .my_env
rm -f mappingcheckhasim_v1.sh validoutput.txt
echo "Collecting Objects To Be Validated...."
if [ $# -eq 0 ];
then
sqlplus -s $CNCTDEV @fetch_object_map_full.sql
chmod 777 mappingcheckhasim_v1.sh
totmapno=`wc -l mappingcheckhasim_v1.sh|cut -d" " -f1`
cp mappingcheckhasim_v1.sh $PM_HOME/../repositoryserver
cd $PM_HOME/../repositoryserver
echo "Starting Validation of $totmapno mappings...."
echo "At -----`date`----- Please wait..It May Take Some Time..."
exec
pmrep $PMREPCONDEV
if [ $? -eq 0 ];
then
echo "Connected With Infa...Parsing..Wait..It may take some time..."
fi;
pmrep run -f mappingcheckhasim_v1.sh -o validoutput.txt -e Hasim
if [ $? -ne 0 ];
then
errormapping=`tail -10 validoutput.txt|grep 'validate -n'|cut -d" " -f3`
echo "Internal Error Occurred While validating $errormapping"
echo "If you wish to get Info about remaining mappings..."
echo "Run
echo "Please dont delete mails untill you become sure you got all info..."
fi;
wait
#exit 0
echo "Validation Finished at -----`date`-----Sending Mail..."
rm -f mappingcheckhasim_v1.sh
cd -
mv $PM_HOME/../repositoryserver/validoutput.txt .
grep 'is VALID **' validoutput.txt>validmappings.txt
grep 'is INVALID ***' validoutput.txt>invalidmappings.txt
totvalidmapno=`wc -l validmappings.txt|cut -d" " -f1`
totinvmapno=`wc -l invalidmappings.txt|cut -d" " -f1`
if [ -s validmappings.txt ];then
cat validmappings.txt|mailx -s "$totvalidmapno Valid mappings in DEV " m_a_hasim@yahoo.com
else
echo "No Valid mappings in DEV"| mailx -s "No Valid mappings in DEV " m_a_hasim@yahoo.com
fi;
if [ -s invalidmappings.txt ];then
cat invalidmappings.txt|mailx -s "$totinvmapno Invalid mappings in DEV " m_a_hasim@yahoo.com
else
echo "No Invalid mappings in DEV"| mailx -s "No Invalid mappings in DEV " m_a_hasim@yahoo.com
fi;
echo "Cheers...Go Ahead..."
else
echo "Starting after mapping $1......"
sqlplus -s $CNCTDEV @fetch_object_map_partial.sql $1
chmod 777 mappingcheckhasim_v1.sh
totmapno=`wc -l mappingcheckhasim_v1.sh|cut -d" " -f1`
cp mappingcheckhasim_v1.sh $PM_HOME/../repositoryserver
cd $PM_HOME/../repositoryserver
echo "Starting Validation of $totmapno mappings...."
echo "At -----`date`----- Please wait..It May Take Some Time..."
exec
pmrep $PMREPCONDEV
if [ $? -eq 0 ];
then
echo "Connected With Infa...Parsing..Wait..It may take some time..."
fi;
pmrep run -f mappingcheckhasim_v1.sh -o validoutput.txt -e Hasim
if [ $? -ne 0 ];
then
errormapping=`tail -10 validoutput.txt|grep 'validate -n'|cut -d" " -f3`
echo "Internal Error Occurred While validating $errormapping"
echo "If you wish to get Info about remaining mappings..."
echo "Run
echo "Please dont delete mails untill you become sure you got all info..."
fi;
wait
#exit 0
echo "Validation Finished at -----`date`-----Sending Mail..."
rm -f mappingcheckhasim_v1.sh
cd -
mv $PM_HOME/../repositoryserver/validoutput.txt .
grep 'is VALID **' validoutput.txt>validmappings.txt
grep 'is INVALID ***' validoutput.txt>invalidmappings.txt
totvalidmapno=`wc -l validmappings.txt|cut -d" " -f1`
totinvmapno=`wc -l invalidmappings.txt|cut -d" " -f1`
if [ -s validmappings.txt ];then
cat validmappings.txt|mailx -s "$totvalidmapno Valid mappings in DEV after error Occured in $1" m_a_hasim@yahoo.com
else
echo "No Valid mappings in DEV after error Occured in $1"| mailx -s "No Valid mappings in DEV after error Occured in $1 " m_a_hasim@yahoo.com
fi;
if [ -s invalidmappings.txt ];then
cat invalidmappings.txt|mailx -s "$totinvmapno Invalid mappings in DEV after error Occured in $1" m_a_hasim@yahoo.com
else
echo "No Invalid mappings in DEV after error Occured in $1"| mailx -s "No Invalid mappings in DEV after error Occured in $1 " m_a_hasim@yahoo.com
fi;
echo "Cheers...Go Ahead..."
fi;
Steps Followed:-
1/
Collected all mappings to be validated.
2/
Made pmrep statements for validation.
3/
sorted valid mappings and invalid mappings in different files.
4/
Mailed them.
Error Handling:-
Some times wat happened is,while validating,pmrep got stuck for some mappings and come out.That time my scipt will tell that there is a problem while validating any specific mapping.And then will give you option to start validating remaining mappings.
---: My blog is not responsible for any damages happened from the suggestion of my blog :---
Reach me at : m_a_hasim@yahoo.com
Labels: Technical_HowTo_Infa