Issue with the shell script

hi , this script was devloped by somebody whome I dont know way back
# cat run_ucid.sh
#!/bin/csh
# run_ucid.sh
#
# This is a simple shell script that will start an application in
# the background and restart the application if it stops. Upon
# termination an email message is sent and the app is restarted by
# default. To disable automatic restart, the script may be started
# with the '-x' command line argument. (Actually, any command line
# argument should have that effect.) Start the app with the nohup
# command allow it to run after logging out.
#
# Instructions:
# 1. Set the variables in the next section for your environment.
# 2. Ensure that the script is executable by all (chmod 755 scriptname).
# 3. Ensure that the script is installed on a host with a mail server.
# 4. Syntax: nohup run_ucid.sh -x & (The -x is optional)
#
# Copyright (c) 2007, Genesys Professional Services. All rights reserved.
#
# Thank you for choosing Genesys Professional Services.

# ---------------------------------------------------------------------------
# SET THESE VARIABLES
# ---------------------------------------------------------------------------
# Do not modify anything on the left of the equal sign.

# Set the email subject
set SUBJECT = "ALERT FROM MMAS27"

# Set a brief email message
set MESSAGE = "UCID terminated."

# Set the email recipient; separate multiple addresses with commas
set RECIPIENT = "rgundermann@reliant.com"

# Set the absolute path to the application
set APPLICATION = "/gcti/UCIDPrimary/UCID-1.6.0/bin/UCID start"

# Set the application name (used by ps command)
set APPNAME = "UCID"

# ---------------------------------------------------------------------------
# DO NOT MODIFY THE SCRIPT BELOW THIS LINE
# ---------------------------------------------------------------------------

start:
$APPLICATION &
set STATE=0
While ($STATE=1)
sleep 5
set COUNT = `ps -ef | grep -c $APPNAME`
if ($COUNT > 1) then
set STATE=1
else
echo $MESSAGE | mailx -s "$SUBJECT" $RECIPIENT
if ($#argv == 0) then
sleep 1
goto start
endif
endif
end
echo Terminating script ...

#

on doing a test run this is the error it gives
# sh -x run_ucid.sh -x &
[1] 4354244
# + set SUBJECT = ALERT FROM MMAS27
+ set MESSAGE = UCID terminated.
+ set RECIPIENT = rgundermann@reliant.com
+ set APPLICATION = /gcti/UCIDPrimary/UCID-1.6.0/bin/UCID start
+ set APPNAME = UCID
+ start:
run_ucid.sh[46]: start:: not found.
+ set STATE=0
run_ucid.sh[49]: 0403-057 Syntax error at line 49 : `(' is not expected.

line 49 is the while loop line , please let me know why is this error coming

My guess is that:

  1. The while should be while not While. (might be a typo that sneaked in when you pasted the code here)
  2. Its a C-shell script (#!/bin/csh). But you're executing it with sh.
  3. In csh the comparison operator is == not =

Thanks ....appreciate your help.