Syntax error on script

Evening All (or morning for some),
Could anyone have a look at the below and advise where i've going wrong with the syntax as i keep getting the below error while trying to run.

Any help would be really apprecaited.

./testout: line 13: syntax error near unexpected token `else'
#!/bin/sh
if ($stat == 'a')
                {
                if (($Type=='p')|| ($Type=='b') || ($Type=='c') || ($Type=='d'))
                        {
                        if      ($Con == 'c' || $Con== 'p')
                                {
                                if      ($Con== 'p')
                                        {
                                        $Da = '1'
                                        echo "Migrated"
                                        }
                                else
                                        {
                                        $Da = '1'
                                        }
                                if ($Pl != "null")
                                        {
                                        $DT = '1'
                                        }
                                }
                        if ($Mig == ' not migrated 1')
                                {
                                echo "not migrated 1"
                                }
                        }
                else
                        {
                        $dar = '1';
                        echo "$DAR Decode 3"
                        }
                }
        else
                {
                $DAR = '1'
                echo "$DAR Decode 4"
                }

Hi,

Seems perl syntax for if , variables are used.

IMHO, you need to update your code as follows:

#!/bin/sh
Type=p
Con=c
Pl=t

if (( $1 == 'a' )); then
	if (( $Type == 'p' )); then
        	if (( $Con == 'c' )) || (( $Con == 'p' )); then
                	if (( $Con == 'p' )); then
                        	Da='1'
                                echo "Migrated"
			else
				Da='1'
			fi
			if (( $Pl != "null" ));then
		                DT='1'
                	fi
		fi
	fi
fi
if ($stat == 'a')
                {
                if (($Type=='p')|| ($Type=='b') || ($Type=='c') || ($Type=='d'))
$Da = '1'

if condition requires space between two equal to symbol ie ==

Hello mutley2202,

A complete if - else needs to be closed by having fi at last but I see at least 3 pairs of if - else here which are not properly closed, kindly do close them properly.

Thanks,
R. Singh

Updated to include the corrections however its still coming up with the same syntax fault.

./testout: line 13: syntax error near unexpected token `else'
#!/bin/sh
if ($stat == 'a')
                {
                if (($Type=='p')|| ($Type=='b') || ($Type=='c') || ($Type=='d'))
                        {
                        if      ($Con == 'c' || $Con== 'p')
                                {
                                if      ($Con== 'p')
                                        {
                                        $Da = '1'
                                        echo "Migrated"
                                        }
                                else
                                        {
                                        $Da = '1'
                                        }
                                fi
                                if ($Pl != "null")
                                        {
                                        $DT = '1'
                                        }
                                }
                        if ($Mig == ' not migrated 1')
                                {
                                echo "not migrated 1"
                                }
                        }
                else
                        {
                        $dar = '1';
                        echo "$DAR Decode 3"
                        }
                fi
                }
        else
                {
                $DAR = '1'
                echo "$DAR Decode 4"
                }
fi

I am afraid what you have posted is not shell syntax.
Here's an interpretation of what you have posted in shell syntax without any effort in correcting the logic flow of it:

if [ "$stat" = a ]
then
    if [ "$Type" = p ] || [ "$Type" = b ] || [ "$Type" = c ] || [ "$Type" = d ]
    then
        if [ "$Con" = c ] || [ "$Con" = p ]
        then
            if [ "$Con" = p ]
            then
                Da=1
                echo "Migrated"
            else
                Da=1
            fi

            if [ -n "$Pl" ]
            then
                DT=1
            fi
        fi

        if [ "$Mig"  = "not migrated 1" ]
        then
            echo "not migrated 1"
        else
            DAR=1
            echo "$DAR Decode 3"
        fi
    else
        DAR=1
        echo "$DAR Decode 4"
    fi
fi

Watch out for extra spaces between assignments.
Watch out for extra $ symbol when doing assignments.
if is not with curly bracket nor does it work like C or C++, the construct is

if [ ... ]
then
...
else
...
fi

There must be a space between expression [ expression ]
Double quote the variable "$name" when evaluating with single [ ] .