FTP connection problem

I am getting the error in this command when i am pitting it in shell script

ftp -nvi jcmpcor1.abc.com >/work/test98.dat << EOD

error:-
invalid command.

but when i am writting it from outside it work fine.

What shell does your script use?

thanks for reply

We are using SH

What commands do you have after it, before the "EOD"?

after that

#Authenticate the user
#user $username $password
user odsftp ods123$

#Change FTP mode to binary
bin
#echo "mode changed to binary"
#Change local directory
#lcd $localDir
lcd /work/tt

#Change remote directory to directory where source files are present
#cd $remoteDir
cd /apps/RStuff/ecm/amazon/adw/incoming/
#echo pwd
#echo "Directory changed ..."
#FTP all files to local directory with the specified filename format
#echo $remoteDir
#mget $strfilename
cp dq1234 /work/
#echo $strfilename
#echo `wc -l $localDir/$strfilename`

#Close FTP connection
close
bye
EOD

"cp" is not a valid FTP command.

wat should in place of cp

How would I know... I don't know what you're trying to do with this script! I guess it should be a get or put command since you aren't transferring files anywhere else in the script.