Macro definition missing null line terminator

Hello All ~ can someone please help me. I'm trying to FTP to a server using the macdef init. All was working before our upgrade to red hat 5. Now my FTP process is falling with error given below.

Connected to 10.9.120.1 (10.9.120.1).
220-FTPD1 IBM FTP CS V1R10 at xyz.gx.yz.xyz, 17:30:39 on 2011-04-08.
220 Connection will not timeout.
Macro definition missing null line terminator.
Remote system type is MVS.
ftp>
ftp>
ftp> quit
221 Quit command received. Goodbye.

Here is my script
for USER_TO_FTP in $(echo ${USERS_FTP})
do
        echo "machine ${USER_TO_FTP} login junka password junk1 "> ${HOME}/.netrc
        echo "macdef init"                  >> ${HOME}/.netrc
        echo "prompt off"                   >> ${HOME}/.netrc
        echo "       "                      >> ${HOME}/.netrc
        echo "ascii"                        >> ${HOME}/.netrc
        echo "lcd /home/prodinst/jobs"      >> ${HOME}/.netrc
        echo "cd DB2CON.SYSREC01"                   >> ${HOME}/.netrc
        echo "put DSNP$filedate.txt PROD$filedate"    >> ${HOME}/.netrc
        echo "close"                        >> ${HOME}/.netrc
        echo "quit\n\n"                     >> ${HOME}/.netrc
        chmod 600 $HOME/.netrc




browx24Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

wesly_chenCommented:
1. Your script have "for" loop, where is "done"?

2.
----
        echo "machine ${USER_TO_FTP} login junka password junk1 "> ${HOME}/.netrc
        echo "macdef init"                  >> ${HOME}/.netrc
        echo "prompt off"                   >> ${HOME}/.netrc
        echo "       "                      >> ${HOME}/.netrc     ===>
change to
echo "" >> ${HOME}/.netrc
or delete this line.

3,
    echo "quit\n\n"                     >> ${HOME}/.netrc
change to
echo " quit" >> ${HOME}/.netrc
echo " " >> $HOME/.netrc
# always end a macdef with a blank line
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
browx24Author Commented:
Hello Mr Chen ~ Thanks for helping. Your solution worked like a charm. Thanks. See complete soln below:

for USER_TO_FTP in $(echo ${USERS_FTP})
do
        echo "machine ${USER_TO_FTP} login xyz password passxyz "> ${HOME}/.netrc
        echo "macdef init"                  >> ${HOME}/.netrc
        echo "prompt off"                   >> ${HOME}/.netrc
        echo "ascii"                        >> ${HOME}/.netrc
        echo "lcd /home/prodinst/jobs"      >> ${HOME}/.netrc
        echo "cd DB2CON.SYSREC01"                     >> ${HOME}/.netrc
        echo "put DSNP$filedate.txt PROD$filedate"    >> ${HOME}/.netrc
        echo "close"                        >> ${HOME}/.netrc
        echo "quit"                         >> ${HOME}/.netrc
        echo ""                             >> $HOME/.netrc
        chmod 600 $HOME/.netrc

# Ping user to ensure communication.
# Invoke ftp for automated logon and transfers.
#---------------------------------------------------------------------
    ping  -q -c1 ${USER_TO_FTP} 1>/dev/null 2>/dev/null
    RSLT=${?}
    echo "$tdateis Ping returns:$RSLT  " \
             | tee -a /home/prodinst/logs/db2con$filedate.log
   if [ ${RSLT} = 0 ]
    then
      tdateis=`date "+%m%d%y %T"`
      echo "$tdateis Ping was good -- now prepare for FTP process " \
             | tee -a /home/prodinst/logs/db2con$filedate.log

      echo "$tdateis Control is now being given to FTP ...please be patient" \
             | tee -a /home/prodinst/logs/db2con$filedate.log

    /usr/bin/ftp ${USER_TO_FTP} >> /home/prodinst/logs/db2con$filedate.log
      echo "$tdateis FTP process complete successfully " \
             | tee -a /home/prodinst/logs/db2con$filedate.log
    else
       echo "$tdateis !!Ping was BAD* TESTING FAILED!! -- FTP did not run " \
             | tee -a /home/prodinst/logs/db2con$filedate.log

       echo "$tdateis Mainframe can't be reached please investigate " \
             | tee -a /home/prodinst/logs/db2con$filedate.log

    fi
done


 
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.