Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

transferring files from AS400 to AIX and back again

Status
Not open for further replies.

bi

Technical User
Apr 13, 2001
1,552
US
I need to transfer files from an AS400 to an AIX box. Once on the AIX box, the files are processed and another set of files has to be sent from the AIX box back to the AS400 box. Eventually, there will be a VAX system that will take the place of the AS400 in this scenario.

I'm testing this out on two AIX systems first. I can't get ftp to work without being prompted for a password. I'm ftp'ing as a user with the Rsh shell on the receiving system. On the sending system, the user has the Korn shell. I have the .netrc file in the user's home directory on the receiving system. The netrc file has the user's name and password. It is owned by root and has permissions of 700. The receiving and sending system have a .rhosts file.

I've read the man pages for netrc, rsh, Rsh and think I'm doing what they say, but I'm still being prompted for the password.

Can anyone steer me in the right direction?

Thanks.

 
do you need a script to automate "ftp"? as far as i knew - you need a user and its password to transfer files using FTP.

just in case you need one, try this - i got this from this site and works for me:

#!/bin/ksh
bindir="/home/ftp/bin"
logdir="/home/ftp/log"
ftp="/usr/bin/ftp"
Email="[Some E-mail Address]"
IP="xxx.xxx.xxx.xxx"
user="[user-id]"
pass="[password]"
ifile="[source file]"
ofile="[destination file]"
type="asc"
myname=`basename $0`
verbose="verbose"
dd=`date +%d`
log="$logdir/$myname.$dd.log"
host=`hostname`
rc=0
boj=`date`

exec 1>$log 2>&1

echo "\n##### Begin FTP Parameters #####\n"
echo "Program Name: $myname"
echo "Process ID: $$"
echo "Log file name: $log"
echo "Email: $Email"
echo "Source Machine $host"
echo "Destination Machine: $IP"
echo "User ID: $user"
echo "Password: ##############"
echo "Source File: $ifile"
echo "Destination File: $ofile"
echo "\n##### End FTP Parameters #####\n\n"

echo "##### Begin FTP Session #####\n"

echo "open $IP
user $user $pass
$verbose
$type
put $ifile $ofile
close
quit" |$ftp -n

echo "\n##### End FTP Session #####"

foo=`grep -i "cannot" $log`
if [ "$?" -eq "0" ] ; then
rc=1
status="Destination file does not exist\n"
fi
foo=`grep -i "does not" $log`
if [ "$?" -eq "0" ] ; then
rc=1
status="${status}Source file does not exist\n"
fi
foo=`grep -i "killed" $log`
if [ "$?" -eq "0" ] ; then
rc=1
status="${status}File transfer process has abended\n"
fi
foo=`grep -i "space" $log`
if [ "$?" -eq "0" ] ; then
rc=1
status="${status}Ran out of disk space before completion of copy\n"
fi

if [ "$rc" -eq "0" ] ; then
status="Successful"
fi

eoj=`date`
echo "\nJob start time: $boj"
echo "Job end time: $eoj"
echo "\nResult code: $rc ($status)"

mail -s &quot;FTP results from $myname&quot; $Email <$log

 
The AS400 does the translation from ebcdic to ascii and vice versa.

I'll check out the links you sent.
 
aixqueen,

works great! you're right +/- than 600 won't work...

correction on:

i'm using AIX 4.3.3/4.3.0, and this directory/file doesn't exist:

/usr/lpp/tcpip/samples/netrc Contains a sample .netrc file with directions for its use.

instead:

/usr/samples/tcpip/netrc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top