SimonTempler
MIS
Here's an excerpt of the code. Please somebody explain this line (MIG_INFO=`grep $1 /u02/app/psoft/fs800/$BASE_ENV_LOWER/migrations/todo/$BATCH`)...I just don't see where the $1 variable is defined anywhere in the function. The script is called M_FQA8.
Thanks for your help.
###################################################################
# Function: update_program #
# Description: This function will be used to update the #
# S_MIG_BATCH_PRG table in the source environment, #
# with the status of the migration. The SQL is #
# dynamically created, using the input parameter: #
# $1 = program name, with extenstion #
###################################################################
function update_program
{
# Change 6 - Begin - added these lines
MIG_INFO=`grep $1 /u02/app/psoft/fs800/$BASE_ENV_LOWER/migrations/todo/$BATCH`
FILE_DESCR=`echo $MIG_INFO | awk -F: '{print $1}'`
OBJECT_INFO=`grep "$FILE_DESCR" objects.txt`
OBJECTTYPE=`echo $OBJECT_INFO | awk '{print $1}'`
OBJECTID1=`echo $OBJECT_INFO | awk '{print $2}'`
OBJECTID2=`echo $OBJECT_INFO | awk '{print $3}'`
# Change 6 - End
if [ -f mig.sql ]
then
rm mig.sql
fi
SHORT_NAME=`echo $1 | awk -F. '{print $1}'`
EXT=".`echo $1 | awk -F. '{print $2}'`"
echo "Update PS_S_MIG_BATCH_PRG " >>mig.sql
echo " set S_MIG_COPYDONE='$DONE_FLG', " >>mig.sql
echo " S_MIG_MESSAGE='$MIG_MSG'" >>mig.sql
echo "where PROJECTNAME='$PROJ_NAME'" >>mig.sql
echo " and S_TGT_ENVIRONMENT='$T_ENV'" >>mig.sql
# Change 6 - Begin - added the if/then/else, these are the old lines
#echo " and OBJECTVALUE1='$SHORT_NAME'" >>mig.sql
#echo " and OBJECTVALUE2='$EXT';" >>mig.sql
if [ "$OBJECTID2" = 0 ]
then
SHORT_NAME=`echo $1 | awk '{print $1}'`
echo " and OBJECTVALUE1='$SHORT_NAME';" >>mig.sql
else
echo " and OBJECTVALUE1='$SHORT_NAME'" >>mig.sql
echo " and OBJECTVALUE2='$EXT';" >>mig.sql
fi
# Change 6 - End
echo " " >>mig.sql
echo "commit;" >>mig.sql
echo " " >> mig.sql
echo "exit" >> mig.sql
echo " " >>mig.log
echo "Update SQL:" >>mig.log
cat mig.sql >> mig.log
sqlplus -s $SQLUSER/$SQLPASS@$BASE_ENV @mig.sql >> mig.log
if [ "$DONE_FLG" = "Y" ]
then
update_history $1
fi
}
Thanks for your help.
###################################################################
# Function: update_program #
# Description: This function will be used to update the #
# S_MIG_BATCH_PRG table in the source environment, #
# with the status of the migration. The SQL is #
# dynamically created, using the input parameter: #
# $1 = program name, with extenstion #
###################################################################
function update_program
{
# Change 6 - Begin - added these lines
MIG_INFO=`grep $1 /u02/app/psoft/fs800/$BASE_ENV_LOWER/migrations/todo/$BATCH`
FILE_DESCR=`echo $MIG_INFO | awk -F: '{print $1}'`
OBJECT_INFO=`grep "$FILE_DESCR" objects.txt`
OBJECTTYPE=`echo $OBJECT_INFO | awk '{print $1}'`
OBJECTID1=`echo $OBJECT_INFO | awk '{print $2}'`
OBJECTID2=`echo $OBJECT_INFO | awk '{print $3}'`
# Change 6 - End
if [ -f mig.sql ]
then
rm mig.sql
fi
SHORT_NAME=`echo $1 | awk -F. '{print $1}'`
EXT=".`echo $1 | awk -F. '{print $2}'`"
echo "Update PS_S_MIG_BATCH_PRG " >>mig.sql
echo " set S_MIG_COPYDONE='$DONE_FLG', " >>mig.sql
echo " S_MIG_MESSAGE='$MIG_MSG'" >>mig.sql
echo "where PROJECTNAME='$PROJ_NAME'" >>mig.sql
echo " and S_TGT_ENVIRONMENT='$T_ENV'" >>mig.sql
# Change 6 - Begin - added the if/then/else, these are the old lines
#echo " and OBJECTVALUE1='$SHORT_NAME'" >>mig.sql
#echo " and OBJECTVALUE2='$EXT';" >>mig.sql
if [ "$OBJECTID2" = 0 ]
then
SHORT_NAME=`echo $1 | awk '{print $1}'`
echo " and OBJECTVALUE1='$SHORT_NAME';" >>mig.sql
else
echo " and OBJECTVALUE1='$SHORT_NAME'" >>mig.sql
echo " and OBJECTVALUE2='$EXT';" >>mig.sql
fi
# Change 6 - End
echo " " >>mig.sql
echo "commit;" >>mig.sql
echo " " >> mig.sql
echo "exit" >> mig.sql
echo " " >>mig.log
echo "Update SQL:" >>mig.log
cat mig.sql >> mig.log
sqlplus -s $SQLUSER/$SQLPASS@$BASE_ENV @mig.sql >> mig.log
if [ "$DONE_FLG" = "Y" ]
then
update_history $1
fi
}