<?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: FTP in Mainframe SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/FTP-in-Mainframe-SAS/m-p/271623#M310738</link>
    <description>&lt;P&gt;I can't see anything in the requirements that would make a SAS session for this beneficial. This could be (better?) handled by OS/ftp commands directly.&lt;/P&gt;</description>
    <pubDate>Thu, 19 May 2016 07:03:31 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2016-05-19T07:03:31Z</dc:date>
    <item>
      <title>FTP in Mainframe SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FTP-in-Mainframe-SAS/m-p/271610#M310736</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the below requirement in our project. Please do the needful.&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Requirement:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;Do FTP connection and retrieve the files from different FTP server.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Input:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;FTP Credentials (FTP User name, Password, FTP server details) in the mainframe PS file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Process:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;Connect with FTP server using the credetials in the input file and Retrieve the files from server using 'FILENAME' statement.&lt;BR /&gt;If there is any FTP error, Retry the FTP connection three times or till successful&lt;BR /&gt;The error should be written into the error output file and the program should continue for the next server.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Output:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;Success output file with retrieved data&lt;/P&gt;&lt;P&gt;Error output file with FTP connection error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Issue:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;Whenever there is FTP connection error, the program throws error with MAXCC = 8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Expected solution:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;Option 1: Overwriting the system return code to JCL.&lt;/P&gt;&lt;P&gt;Option 2: Before foing FTP connection for retrieving, i want to check whether the server is UP or down to avoid the error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Saradhadevi. I&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 06:05:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FTP-in-Mainframe-SAS/m-p/271610#M310736</guid>
      <dc:creator>Saradhadevi</dc:creator>
      <dc:date>2016-05-19T06:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: FTP in Mainframe SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FTP-in-Mainframe-SAS/m-p/271612#M310737</link>
      <description>&lt;P&gt;To check if a server is up, one usually uses &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ping&lt;/FONT&gt;&lt;/STRONG&gt;. So you will have to look for the MF equivalent of this UNIX-typical utility.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
x = system("ping -c1 server_that_is_up");
put x=;
x = system("ping -c1 server_that_is_not_up");
put x=;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;would produce this in the log:&lt;/P&gt;
&lt;PRE&gt;16         data _null_;
17         x = system("ping -c1 server_that_is_up");
18         put x=;
19         x = system("ping -c1 server_that_is_not_up");
20         put x=;
21         run;

x=0
x=1
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds
&lt;/PRE&gt;
&lt;P&gt;on a UNIX type SAS server.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The current state of the SAS session is kept in the automatic macro variable SYSCC. You can check for this state before and after your data step that uses the FTP connection; if necessary, you can set SYSCC back to 0 with a simple&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let syscc=0;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 May 2016 06:21:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FTP-in-Mainframe-SAS/m-p/271612#M310737</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-05-19T06:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: FTP in Mainframe SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FTP-in-Mainframe-SAS/m-p/271623#M310738</link>
      <description>&lt;P&gt;I can't see anything in the requirements that would make a SAS session for this beneficial. This could be (better?) handled by OS/ftp commands directly.&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 07:03:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FTP-in-Mainframe-SAS/m-p/271623#M310738</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-05-19T07:03:31Z</dc:date>
    </item>
  </channel>
</rss>

