Hi everyone,
can someone please tell me what can be wrong here?
Script:
ftp -v -n $FTPSERVER<< EOP >$LOGFILE 2>&1
user $USERID $PASSWD
ascii
site lrecl=500
site cyl
site PRI=600
site SEC=300
lcd $FTPLOCALDIR
cd $FTPTARGETDIR
put $SOURCEFILE $TARGETFILE
quit
EOP
Output:
Connected to usfshux01-e1.amer.umusic.net.
220 USFSHUX01 FTP server (Version 4.1 Fri Nov 21 11:01:48 CST 2003) ready.
331 Password required for ftpuser.
230-Last unsuccessful login: Tue Jul 3 07:23:02 PDT 2007 on ssh from 10.131.13.17
230-Last login: Thu Jul 12 04:19:37 PDT 2007 on ftp from ::ffff:10.131.50.155
230 User ftpuser logged in.
200 Type set to A; form set to N.
500 'SITE LREC=500': command not understood.
500 'SITE CYL': command not understood.
500 'SITE PRI=600': command not understood.
500 'SITE SEC=300': command not understood.
Local directory now /taf/dev/workfiles
250 CWD command successful.
200 PORT command successful.
150 Opening data connection for P40DEV.J51.A130001.O999999.YYQ20063.NORMsw.
netout: write returned 0?
226 Transfer complete.
221 Goodbye.
Thanks in advance!
Cheers,
Sandra
'site' is not an 'ftp' command.
Hello Shell life,
I'm sorry for this mistake.
I'm a mainframe (adabas natural) expert and a Unix dummie. We will migrate from mainframe to unix and someone else wrote this script, but I encounter this error now, so that's why I'm here. Maybe the order is wrong, or it is wrong that it is put to capitals....
Is there somebody who can tell me something?
Thanks.
Sandra
Sandra,
Try to run the ftp without the 'site' commands and see if it does
what you want.
The purpose of 'ftp' is just to transfer files amongst machines.
Hi,
the ftp does work without the site commands. But we are ftp-ing to a mainframe and we need a fixed recordlenght of 500.
Thanks.
Sandra
Sandra,
Run this script in the unix box where the file you want to transfer resides.
Make sure there is no '|' anywhere in the file.
If there is, then choose another character that for sure is not present in the file.
typeset -i mCnt=0
typeset -L500 mOutLine
mInpFile='your_input_file'
while [ ${mCnt} -lt 500 ]
do
m500Chars=${m500Chars}'|'
mCnt=${mCnt}+1
done
while read mLine
do
mOut2=${mLine}${m500Chars}
echo ${mOutLine} >> $$Temp
done < ${mInpFile}
sed 's/|/ /g' $$Temp > ${mInpFile}
rm -f $$Temp
What OS are you using? Most ftp clients do indeed have a site command. You must have an old version of unix.
Thank you shell life,
we will learn a lot from this.
When I do understand your piece of scripting right, then it does the while-loop 500 times for each record. We come from the mainframe and we have files of more than 1 milion records, so I don't think this is an option for us.
Thanks.
Sandra
We know now! An old colleague helped us.
Ftp from unix to a mainframe does not work properly. It cuts of at 256 digits.
We need a fixed recordlenght.
We will have to use
quote site fixrecfm 500
site command would put it to recordlenght 500 locally. And quote site does this on the remote site, to where it is ftp-ed.
Have a good day and a good weekend!!
Sandra
Selecting record format and record length for CMS.
By default, all files transferred using FTP will have variable record format. If you are transferring a file to CMS which must/ought to be in a fixed record format or which should have a specific record length, use the site command of FTP on CMS.
Before GETing files to CMS using FTP on CMS, enter:
site fixrecfm nnnn
Before PUTing files to CMS using FTP on a PC or another local host, enter:
quote site fixrecfm nnnn
in both cases, nnnn is the record length you want the transferred file to have. The quote command sends the specified command to the remote FTP for execution. The command site varrecfm restores the default variable record format. (Include quote if necessary.)
From: http://www.uic.edu/depts/accc/network/ftp/vftp.html
Sandra
Sandra,
The while-loop 500 times is just to assign 500 pipes '|' into one variable.
It is performed only once.
The second while-loop is the one that reads the entire file and tries to attach
the 500 characters variable at the end of each record.
The result length of each record is 500, which is written to the output.
Oh yes, I see.
Thanks.
I've learned a lot today.
Thanks.
Sandra