Return: can only `return' from a function or sourced script

Not sure where the problem is. I can run the script without any issue using the following command.

. /opt/app/scripts/cdc_migration.sh

But it fails with the below error when I try it this way

/opt/app/scripts/cdc_migration.sh

/opt/app/scripts/cdc_migration.sh: line 65: return: can only `return' from a function or sourced script.

Here's the full script

#!/bin/sh

. ${HOME}/.profile
Usage()
{
cat <<EOF

Usage:
$. /opt/app/scripts/progname -un <USER> -epwd <user_encrypted_pwd> -tu <target_user> -tepwd <target_password> -src <source_listener> -tgt <target_listener> -sdbid <source_db_id> -tdbid <target_db_id> -sschema <src_schema> -tschema <tgt_schema> -test <Y/N>
Example: . /opt/app/scripts/cdc_migration.sh -un USRPDM1_PRRCDC_D -epwd 8E5D00862442061C2383E6661CB93967 -tu USRPDM1_PRRCDC_A -tp 229143B50D056104F445DD63D7214195A3AB5B84D96CE0B2 -src pwxlstnorad -tgt pwxlstnoraa -sdbid CDCPDMD -tdbid CDCPDMA -sschema d8cdcpdmd -tschema d8cdcpdma -test Y

EOF
}

# Get the command line arguments
if [ $# -lt 11 ]
then
   Usage;
   return 1;
fi
user_name=""
enc_pwd=""
tgt_user=""
tgt_epwd=""
src_lstnr=""
tgt_lstnr=""
src_dbid=""
tgt_dbid=""
sschema=""
tschema=""
test=""
while [ $# -gt 0 ]
do
    case "$1" in
        -un)  user_name="$2"; shift;;
        -epwd)  enc_pwd="$2"; shift;;
        -tu)  tgt_user="$2"; shift;;
        -tp)  tgt_epwd="$2"; shift;;
        -src) src_lstnr="$2"; shift;;
        -tgt) tgt_lstnr="$2"; shift;;
        -sdbid) src_dbid="$2"; shift;;
        -tdbid) tgt_dbid="$2"; shift;;
        -sschema) sschema="$2"; shift;;
        -tschema) tschema="$2"; shift;;
        -test) test="$2"; shift;;
        --)     shift; break;;
        -*)
            Usage;
            return 1;;
        *)  break;;     # terminate while loop
    esac
    shift
done

if [ "$user_name" = "" ] ||  [ "$enc_pwd" = "" ] || [ "$tgt_user" = "" ] || [ "$tgt_epwd" = "" ] || [ "$src_lstnr" = "" ] || [ "$tgt_lstnr" = "" ] || [ "$src_dbid" = "" ] || [ "$tgt_dbid" = "" ]  || [ "$sschema" = "" ]  || [ "$tschema" = "" ] || [ "$test" = "" ]; then
   Usage; return 1;
fi

migr_date=`date '+%Y%m%d%H%M%S'`
# creating extraction maps ini file.

xmaps_ini=migr_xmaps_$migr_date.ini

echo "USER $user_name;" >> $xmaps_ini
echo "EPWD $enc_pwd;" >> $xmaps_ini
echo "TARGETUSER $tgt_user;" >> $xmaps_ini
echo "TARGETEPWD $tgt_epwd;" >> $xmaps_ini
echo "SOURCE $src_lstnr;" >> $xmaps_ini
echo "TARGET $tgt_lstnr;" >> $xmaps_ini
echo "DETAIL;" >> $xmaps_ini
echo "XM_COPY;" >> $xmaps_ini

xmap_names=`ls -l $xmaps |awk '{print $9}'|cut -d "." -f2-2`

IFS=$'\n'
    for x in $xmap_names
    do
        echo "SELECT MAP=$x;" >> $xmaps_ini
    done
echo "RENAME SCHEMA=( "${sschema}","${tschema}" );" >> $xmaps_ini
echo "MODIFY NEW_DBID=$tgt_dbid;" >> $xmaps_ini

        if [ "$test" = "Y" ]; then
                echo "VALIDATE;" >> $xmaps_ini
                        else
                echo "REPLACE;" >> $xmaps_ini
        fi
# creating registrations ini file

reg_ini=migr_regs_$migr_date.ini

echo "USER $user_name;" >> $reg_ini
echo "EPWD $enc_pwd;" >> $reg_ini
echo "TARGETUSER $tgt_user;" >> $reg_ini
echo "TARGETEPWD $tgt_epwd;" >> $reg_ini
echo "SOURCE $src_lstnr;" >> $reg_ini
echo "TARGET $tgt_lstnr;" >> $reg_ini
echo "DETAIL;" >> $reg_ini
echo "REG_COPY;" >> $reg_ini
#echo "KEEPREGTAG;" >> $reg_ini

reg_names=`ls -l $xmaps |awk '{print $9}'|cut -d "." -f2-2`

IFS=$'\n'
    for x in $reg_names
    do
        echo "SELECT DBID = $src_dbid REG_NAME=$x;" >> $reg_ini
    done
echo "RENAME SCHEMA=( "${sschema}","${tschema}" );" >> $reg_ini
echo "MODIFY NEW_DBID=$tgt_dbid;" >> $reg_ini

        if [ "$test" = "Y" ]; then
                echo "VALIDATE;" >> $reg_ini
                        else
                echo "REPLACE;" >> $reg_ini
        fi
# migrate extraction maps

dtlurdmo $xmaps_ini >> $scrlog/`echo "$xmaps_ini"|cut -d "." -f1`.log
dtlurdmo $reg_ini >> $scrlog/`echo "$reg_ini"|cut -d "." -f1`.log

mv $xmaps_ini $scripts/ini_files
mv $reg_ini $scripts/ini_files

A return statement is used to exit a function. I think you are looking for the exit statement ?