Problem with embedded FTP command in Ksh - System Cannot find the specified path.

I have the following FTP embedded in a Ksh script on AIX 5.3

 
ftp -n <<WHATEVER
 open 10.101.26.218
 user hcistats *******
 ascii
 put $thupdatefile 
 put $thcollectfile
 quit
WHATEVER

Here is what my script returns:

 
/qdxtest/qdx5.4/integrator/archiveqdx/hcistats.thupdate.20091118.csv: The system cannot find the path specified.
/qdxtest/qdx5.4/integrator/archiveqdx/hcistats.thcollect.20091118.csv: The system cannot find the path specified.

However the files exists:

 
/>ls -al /qdxtest/qdx5.4/integrator/archiveqdx/hcistats.thupdate.20091118.csv
-rw-rw-r--   1 hci      staff          7103 Nov 19 15:26 /qdxtest/qdx5.4/integrator/archiveqdx/hcistats.thupdate.20091118.csv

/>ls -al /qdxtest/qdx5.4/integrator/archiveqdx/hcistats.thcollect.20091118.csv
-rw-rw-r--   1 hci      staff          9241 Nov 19 15:26 /qdxtest/qdx5.4/integrator/archiveqdx/hcistats.thcollect.20091118.csv

I can even view the contents of the file, so permissions should be fine.

 
/>head /qdxtest/qdx5.4/integrator/archiveqdx/hcistats.thupdate.20091118.csv
TH,20091119,TOdfm,,1A58Tdfm,msjst1,hsdvim2b,TO,dfm,pdl-tcpip,frl,,Client,10.40.96.17,9600,805,468,,,,
TH,20091119,TRdfm,,1A58Tdfm,msjst1,hsdvim2b,TR,dfm,pdl-tcpip,HL7 2.2,,Server,,7128,806,398,,,,
TH,20091119,TRmisysl,,1A16Tmisysl,msjst1,hsdvim2b,TR,misysl,pdl-tcpip,HL7 2.2,,Server,,7145,1069,397,,,,
TH,20091119,TOmisysl,,1A16Tmisysl,msjst1,hsdvim2b,TO,misysl,pdl-tcpip,frl,,Client,10.43.95.244,5005,1069,468,,,,
TH,20091119,TRpyxis,,1A4Tpyxis,msjst1,hsdvim2b,TR,pyxis,pdl-tcpip,HL7 2.2,,Server,,7152,1203,397,,,,
TH,20091119,TOpyxis,,1A4Tpyxis,msjst1,hsdvim2b,TO,pyxis,pdl-tcpip,frl,,Client,10.140.18.12,1001,1203,468,,,,
TH,20091119,TOpwrscb,,1A57Tpwrscb,msjst1,hsdvim2b,TO,pwrscb,pdl-tcpip,frl,,Client,10.4.49.20,18010,671,468,,,,
TH,20091119,TRpwrscb,,1A57Tpwrscb,msjst1,hsdvim2b,TR,pwrscb,pdl-tcpip,HL7 2.2,,Server,,7125,671,398,,,,
TH,20091119,TOephny,,1A19Tephny,msjst1,hsdvim2b,TO,ephny,pdl-tcpip,frl,,Client,10.40.95.23,7518,1470,468,,,,
TH,20091119,TRephny,,1A19Tephny,msjst1,hsdvim2b,TR,ephny,pdl-tcpip,HL7 2.2,,Server,,7169,1470,397,,,,

/>head /qdxtest/qdx5.4/integrator/archiveqdx/hcistats.thcollect.20091118.csv
TH,20091118,20091119152435,TOdfm,1A58Tdfm,msjst1,hsdvim2b,up,up,20091113123131,19000101000000,20091119145338,20091119145338,10,6190,0,0
TH,20091118,20091119152437,TRdfm,1A58Tdfm,msjst1,hsdvim2b,up,up,20091113123159,19000101000000,20091119145338,19000101000000,42,47160,0,0
TH,20091118,20091119152439,TRmisysl,1A16Tmisysl,msjst1,hsdvim2b,up,up,20091113123204,19000101000000,20091119145338,19000101000000,43,48515,0,0
TH,20091118,20091119152441,TOmisysl,1A16Tmisysl,msjst1,hsdvim2b,up,up,20091113123240,19000101000000,20091119145338,20091119145338,43,22508,0,0
TH,20091118,20091119152443,TRpyxis,1A4Tpyxis,msjst1,hsdvim2b,up,up,20091113123233,19000101000000,20091119145338,19000101000000,23,32035,0,0
TH,20091118,20091119152445,TOpyxis,1A4Tpyxis,msjst1,hsdvim2b,up,up,20091113123315,19000101000000,20091119145338,20091119145338,22,12493,0,0
TH,20091118,20091119152447,TOpwrscb,1A57Tpwrscb,msjst1,hsdvim2b,up,up,20091113123305,19000101000000,20091119145338,20091119145338,11,2957,0,0
TH,20091118,20091119152449,TRpwrscb,1A57Tpwrscb,msjst1,hsdvim2b,up,up,20091113123432,19000101000000,20091119145338,19000101000000,11,21359,0,0
TH,20091118,20091119152451,TOephny,1A19Tephny,msjst1,hsdvim2b,up,up,20091113123359,19000101000000,20091116154327,20091116154325,0,0,0,0
TH,20091118,20091119152453,TRephny,1A19Tephny,msjst1,hsdvim2b,up,up,20091113123444,19000101000000,20091119001046,19000101000000,1,771,0,0

Anyone have ideas why the FTP command can't find my files? Suggestions on how this could be done differently?

Thanks!
Troy

Is this a cron file entry? It looks as if the environment is not set correctly.

Its not a cron entry. I'm running the script from the command line. The same script creates the files and executes the FTP.

#!/usr/bin/ksh


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #


function hcistats_main {

# Setup the logfile and error file
logfile="$HCIROOT/archiveqdx/hcistats.$today.log"
errfile="$HCIROOT/archiveqdx/hcistats.$today.err.log"

# Initialize total messages processed on this server
hosttotal=0

# If a date is supplied, collect stats for that date
if [[ -n $1 ]]
then
	collectdate=$1
fi

# setup daily stat collection files
thcollectfile="$HCIROOT/archiveqdx/hcistats.thcollect.$collectdate.csv"
prcollectfile="$HCIROOT/archiveqdx/hcistats.prcollect.$collectdate.csv"
stcollectfile="$HCIROOT/archiveqdx/hcistats.stcollect.$collectdate.csv"
svcollectfile="$HCIROOT/archiveqdx/hcistats.svcollect.$collectdate.csv"

# setup daily info update files
thupdatefile="$HCIROOT/archiveqdx/hcistats.thupdate.$collectdate.csv"
prupdatefile="$HCIROOT/archiveqdx/hcistats.prupdate.$collectdate.csv"
stupdatefile="$HCIROOT/archiveqdx/hcistats.stupdate.$collectdate.csv"
svupdatefile="$HCIROOT/archiveqdx/hcistats.svupdate.$collectdate.csv"

echo "\n------------------------- hcistats initiated $today -------------------------" >> $errfile

rm $thcollectfile $prcollectfile $stcollectfile $svcollectfile $thupdatefile >> $logfile 2>> $errfile

# If a site argument is supplied just run for that site.
if [[ -n $2 ]]
then
	mysites=$2
else
  # get a list of sites
  mysites=`cat $HCIROOT/prodsites`
fi

echo "--------------------------- Run date: $today -------------------------"       >> $logfile
echo "------------------------- Stats Date: $collectdate -------------------------" >> $logfile

# Get name of server I'm running on
myhost=`hostname`
echo "----------------------------- Server: $myhost -------------------------" >> $logfile

echo "User specified sites:\n$mysites"                                              >> $logfile

for mysite in $mysites
do
  
  # Setup Cloverleaf environment variables and hci commands
  setroot
  setsite $mysite
  
  # Verify the setsite command was successful
  sitecheck=`showroot | grep "HCI site" | awk '{print $4}'`
  if [[ $sitecheck == $mysite ]]
  then
  
    # If the site directory exists in archives, get stats
    mysitedir=$HCIROOT/archiveqdx/$mysite
    if [[ -d $mysitedir ]]
    then
    	
    	 echo "\n------------------------- Site: $mysite -------------------------" >> $logfile
       sitetotal=`hcistats_site $myhost $mysite`
       hosttotal=$(( $hosttotal + $sitetotal ))
       
    else
    
       echo "ERROR - Archive directory \"$mysitedir\" not found.  Skipping site $mysite." >> $errfile
       
    fi
    
  else 
  
  	 echo "ERROR - Setsite Command failed for $mysite.  Skipping site $mysite." >> $errfile
    
  fi

done

echo "Total messages for server $myhost: $hosttotal" >> $logfile
echo "--------------------------------------------------------------------------------" >> $logfile

ftp -n <<WHATEVER
 open 10.101.26.218
 user hcistats *******
 ascii
 put $thupdatefile 
 put $thcollectfile
 quit
WHATEVER

}

The failure is probably because the full path does not exist on the remote ftp server.
If you just want to place the file in the home directory of the remote ftp server consider doing a shell "cd" before the ftp and use the filename without the directory name in the "put" statement.