Script not running from cron

Hi,

I''ve made a script that's running fine from the command line but when running from cron it encounters the following issue:

/tmp/tstscript/testfail.ksh: typeset: not found

I've searched in Google and couldn't find anything, here's the beggining of the script (I can post the rest if necessary):

#!/usr/bin/ksh

typeset -i quant
flag=n

(...)

Any help on this would be more than welcome.

Actually putting the whole script will help in understand the whole scenario

Here it is:

#!/usr/bin/ksh

typeset -i quant
flag=n
DBOS=`env | grep  BO | egrep -v "longmsumu1|stream" | awk '{ FS="=+" } { print $1 }' | xargs`
for env in `echo $DBOS`
do
        /apps/sum_glob/gbo_live/sparse/bin/dmg_cronlaunch -ENVI $env -EXE  /home/gbouausr/bin/failq.ksh
        LOADERS=`grep LDR /tmp/result.txt | awk '{printf $1 "\n"}' | xargs`
        for ldr in $LOADERS
        do
                quant=`grep $ldr /tmp/result.txt | awk '{printf $2}'`
                if [ "$quant" -gt 100 ]
                then
                        flag=y
                        echo "$env: $ldr  $quant" >> /tmp/extr_over10k.txt
                fi
        done
                rm /tmp/result.txt
done
if [ $flag = "y" ]
then
        cat /tmp/extr_over10k.txt | mailx -s "Instances with more than 100 trades in the Fail Queue" -r <mail_address>"
fi

rm /tmp/extr_over10k.txt

Your error message suggests that you are running Bourne Shell not Korn Shell.

Check this line and make sure that it is the very first line of the script. Anywhere else and it won't change the Shell to ksh. Even a blank line will stop it working.

I've tried that as well but it's not working. Also the default shell is Korn shell:

gbouausr@longmsumu1$> echo $SHELL
/bin/ksh