Syntax Error in Unix Shell Script

I am trying to run a unix script in my home directory.Snippet below

 
echo "`date '+%Y%m%d_%H%M%S'` Getting ProductList.dat"
if ( -f $DIR/ProductList.dat) then
 cp  $DIR/ProductList.dat MigratedProductList.dat
else
 echo "`date '+%Y%m%d_%H%M%S'`ProductList.dat does not exist; Processing Terminated"
 echo "***************************************************************************"
 exit 1
endif

It gives me error like

 
1. syntax error at line 31 : `else' unmatched
2. -f:  not found
3.  /ProductList.dat:  not found(ProductList.dat  is already present in the specified location)

My entire script runs fine in another user account.Will there be any difference for the command and syntax if we run in our home directory

Please help

Are you running the script as "~/myscript" or "./myscript".
Check your PATH environment variable to make sure that you are running the right script.

The other user account seems to use csh or a similar shell. Does the account you get the error use the same shell?

-f option is for checking file, whether its ordinary or not.
What exactly you want to check? only the existence, then try -r option, you can copy that.

echo "`date '+%Y%m%d_%H%M%S'` Getting ProductList.dat" 
if [ -f $DIR/ProductList.dat ]; then     
      cp  $DIR/ProductList.dat $TARGET_DIR/MigratedProductList.dat 
else     
      echo "`date '+%Y%m%d_%H%M%S'`ProductList.dat does not exist; Processing Terminated"     
      echo "***************************************************************************"     
      exit 1 
fi

Got the fix for my issue

type

 
echo $SHELL

It will give the default shell.For my home directory it was ksh and my script was csh

So added this to the beggining of my script

 
#!/bin/csh

Thanks for replying to my thread