<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Transfer a zip file from other server to sas sftp server in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Transfer-a-zip-file-from-other-server-to-sas-sftp-server/m-p/13861#M2080</link>
    <description>Dear DF,&lt;BR /&gt;
&lt;BR /&gt;
Can you please alloborate some more as I am a new to programming.</description>
    <pubDate>Thu, 16 Jun 2011 09:22:09 GMT</pubDate>
    <dc:creator>vimal</dc:creator>
    <dc:date>2011-06-16T09:22:09Z</dc:date>
    <item>
      <title>Transfer a zip file from other server to sas sftp server</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Transfer-a-zip-file-from-other-server-to-sas-sftp-server/m-p/13859#M2078</link>
      <description>Dear ,&lt;BR /&gt;
&lt;BR /&gt;
I am using this code to transfer a zip file from other server to sas sftp server.&lt;BR /&gt;
But I am getting a corrupted file.&lt;BR /&gt;
Please help me.&lt;BR /&gt;
&lt;BR /&gt;
data _null_ ;&lt;BR /&gt;
X 'umask 0000';&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
x '@echo off';&lt;BR /&gt;
x 'cd &lt;DESTINATION_LOCATION&gt;';&lt;BR /&gt;
x 'echo open &lt;SOURCE_SERVER&gt; &amp;gt; &lt;DESTINATION_LOCATION&gt;b.ftp';&lt;BR /&gt;
x 'echo user user pwd  &amp;gt;&amp;gt; &lt;DESTINATION_LOCATION&gt;b.ftp' ;&lt;BR /&gt;
&lt;BR /&gt;
x "echo cd &lt;SOURCE_SERVER&gt;  &lt;DESTINATION_LOCATION&gt;b.ftp";&lt;BR /&gt;
x 'echo asc &amp;gt;&amp;gt; &lt;DESTINATION_LOCATION&gt;b.ftp';&lt;BR /&gt;
x "echo get 6546_file.zip &amp;gt;&amp;gt; &lt;DESTINATION_LOCATION&gt;b.ftp";&lt;BR /&gt;
&lt;BR /&gt;
x 'echo bye &amp;gt;&amp;gt; &lt;DESTINATION_LOCATION&gt;b.ftp ';&lt;BR /&gt;
x 'ftp -ni &amp;lt;&amp;lt;destination_location&amp;gt;b.ftp &amp;gt; &lt;DESTINATION_LOCATION&gt;b.ftplog';&lt;BR /&gt;
&lt;BR /&gt;
x 'echo bye';&lt;/DESTINATION_LOCATION&gt;&lt;/DESTINATION_LOCATION&gt;&lt;/DESTINATION_LOCATION&gt;&lt;/DESTINATION_LOCATION&gt;&lt;/DESTINATION_LOCATION&gt;&lt;/SOURCE_SERVER&gt;&lt;/DESTINATION_LOCATION&gt;&lt;/DESTINATION_LOCATION&gt;&lt;/SOURCE_SERVER&gt;&lt;/DESTINATION_LOCATION&gt;</description>
      <pubDate>Wed, 15 Jun 2011 05:32:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Transfer-a-zip-file-from-other-server-to-sas-sftp-server/m-p/13859#M2078</guid>
      <dc:creator>vimal</dc:creator>
      <dc:date>2011-06-15T05:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: Transfer a zip file from other server to sas sftp server</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Transfer-a-zip-file-from-other-server-to-sas-sftp-server/m-p/13860#M2079</link>
      <description>You might try specifying binary transfer mode before moving any of the files?  Just send the command "bin" in the same way you have done so for the others.</description>
      <pubDate>Wed, 15 Jun 2011 08:04:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Transfer-a-zip-file-from-other-server-to-sas-sftp-server/m-p/13860#M2079</guid>
      <dc:creator>DF</dc:creator>
      <dc:date>2011-06-15T08:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: Transfer a zip file from other server to sas sftp server</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Transfer-a-zip-file-from-other-server-to-sas-sftp-server/m-p/13861#M2080</link>
      <description>Dear DF,&lt;BR /&gt;
&lt;BR /&gt;
Can you please alloborate some more as I am a new to programming.</description>
      <pubDate>Thu, 16 Jun 2011 09:22:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Transfer-a-zip-file-from-other-server-to-sas-sftp-server/m-p/13861#M2080</guid>
      <dc:creator>vimal</dc:creator>
      <dc:date>2011-06-16T09:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Transfer a zip file from other server to sas sftp server</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Transfer-a-zip-file-from-other-server-to-sas-sftp-server/m-p/13862#M2081</link>
      <description>Sure - sorry if I was a bit too vague!&lt;BR /&gt;
&lt;BR /&gt;
You have a line in your code that reads:&lt;BR /&gt;
&lt;BR /&gt;
x 'echo asc &amp;gt;&amp;gt; &lt;DESTINATION_LOCATION&gt;b.ftp';&lt;BR /&gt;
&lt;BR /&gt;
The "asc" tells FTP to transfer the file in ASCII mode.  This works for text files like CSV or .tab, etc. and will automatically translate between Windows and UNIX text formats (for example).&lt;BR /&gt;
&lt;BR /&gt;
However a ZIP file is not a text file, so this reformatting will corrupt the file.  Try changing it instead to be:&lt;BR /&gt;
&lt;BR /&gt;
x 'echo bin &amp;gt;&amp;gt; &lt;DESTINATION_LOCATION&gt;b.ftp';&lt;BR /&gt;
&lt;BR /&gt;
That should tell it to copy in binary mode, and should hopefully stop your file corruption.&lt;BR /&gt;
&lt;BR /&gt;
This article has some good notes on the subject: &lt;A href="http://www.remote-control.net/articles/2006/ftp_notes/" target="_blank"&gt;http://www.remote-control.net/articles/2006/ftp_notes/&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Hope that helps!&lt;/DESTINATION_LOCATION&gt;&lt;/DESTINATION_LOCATION&gt;</description>
      <pubDate>Thu, 16 Jun 2011 15:22:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Transfer-a-zip-file-from-other-server-to-sas-sftp-server/m-p/13862#M2081</guid>
      <dc:creator>DF</dc:creator>
      <dc:date>2011-06-16T15:22:50Z</dc:date>
    </item>
  </channel>
</rss>

