<?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: Unix X Command Exit Code Retrieval for curl command in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Unix-X-Command-Exit-Code-Retrieval-for-curl-command/m-p/136724#M27668</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks!&amp;nbsp; Had to use curl b/c of SSL error (used to use URL but certificates expired).&amp;nbsp; Being able to see the output to terminal in the log helps as well. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate your time!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Nov 2013 18:24:00 GMT</pubDate>
    <dc:creator>cjinsf</dc:creator>
    <dc:date>2013-11-22T18:24:00Z</dc:date>
    <item>
      <title>Unix X Command Exit Code Retrieval for curl command</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unix-X-Command-Exit-Code-Retrieval-for-curl-command/m-p/136721#M27665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&amp;nbsp; Need a little help with an unix x command and its exit code in a macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The command is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x "curl -k &amp;amp;loc. &amp;gt; /var/sas/projects/analyses/data_temp.txt";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Occasionally the web address in &amp;amp;loc. will just 'hang'- nothing happens and the SAS program doesn't continue (I know it's a valid address).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was thinking something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x "timeout 2s curl -k &amp;amp;loc. &amp;gt; /var/sas/projects/analyses/data_temp.txt";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;might work- if the command times out there is a non-zero exit code so doing something like "retry until exit code = 0" might work (because the macro loops through and populates &amp;amp;loc. with different web addresses I don't want to lose the current value of &amp;amp;loc.; I know the problem is isn't the value of &amp;amp;loc. b/c there is success during subsequent sessions and a different previously successful web address &lt;EM&gt;may&lt;/EM&gt; get stuck...).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I get the exit code?&amp;nbsp; Is it sysrc?&amp;nbsp; What would be the best way to keep trying the current &amp;amp;loc. until there is success?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(This macro previously ran with no problems; being able to re-try the current &amp;amp;loc. and see if it gets stuck again will help figure out why a problem has recently arisen).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Nov 2013 19:23:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unix-X-Command-Exit-Code-Retrieval-for-curl-command/m-p/136721#M27665</guid>
      <dc:creator>cjinsf</dc:creator>
      <dc:date>2013-11-08T19:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Unix X Command Exit Code Retrieval for curl command</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unix-X-Command-Exit-Code-Retrieval-for-curl-command/m-p/136722#M27666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would look at Piping. &lt;A href="http://support.sas.com/documentation/cdl/en/hostunx/64815/HTML/default/viewer.htm#n1ceb0xedanuj3n19l3g73awk1wf.htm" title="http://support.sas.com/documentation/cdl/en/hostunx/64815/HTML/default/viewer.htm#n1ceb0xedanuj3n19l3g73awk1wf.htm"&gt;SAS(R) 9.4 Companion for UNIX Environments&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It eliminates the temp.txt file as possible cause for hang-up. Watch the locking notes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As curl is a Unix command to transfers docs Why using that when SAS has also those interfaces (FTP SFTP URL)?&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lestmtsref/65040/HTML/default/viewer.htm#p0xln1fiwsr340n1xxf4mkmfxp6f.htm" title="http://support.sas.com/documentation/cdl/en/lestmtsref/65040/HTML/default/viewer.htm#p0xln1fiwsr340n1xxf4mkmfxp6f.htm"&gt;SAS(R) 9.4 Statements: Reference&lt;/A&gt; (sftp) When this is sufficient it wil give you more control in all options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you want to use curl Unix steps think about running the logical flow system with a professional scheduler like LSF&amp;nbsp; &lt;/P&gt;&lt;P&gt;It will solve timings delay-s hangups etc as monitoring on process-flow proceeding is one of the goals.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Nov 2013 09:38:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unix-X-Command-Exit-Code-Retrieval-for-curl-command/m-p/136722#M27666</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2013-11-09T09:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Unix X Command Exit Code Retrieval for curl command</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unix-X-Command-Exit-Code-Retrieval-for-curl-command/m-p/136723#M27667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I find that the SAS log is much clearer if you avoid the X or SYSEXEC command and instead use a PIPE within a DATA _NULL_ so that you can capture any messages that the program you are calling was trying to send to the terminal.&amp;nbsp; You probably also need to watch for special characters in your URL that might confuse SAS or your operating system's shell.&amp;nbsp; The QUOTE() function is useful if the macro variable includes double quote characters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let loc=&lt;A class="jive-link-external-small" href="http://mysite.com/"&gt;http://mysite.com&lt;/A&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; infile %sysfunc(quote(&lt;SPAN style="background-color: #ffffff;"&gt;curl -k &amp;amp;loc. &amp;gt; /var/sas/projects/analyses/data_temp.txt)) pipe ;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; input ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; put _infile_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Nov 2013 19:15:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unix-X-Command-Exit-Code-Retrieval-for-curl-command/m-p/136723#M27667</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-11-09T19:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: Unix X Command Exit Code Retrieval for curl command</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unix-X-Command-Exit-Code-Retrieval-for-curl-command/m-p/136724#M27668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks!&amp;nbsp; Had to use curl b/c of SSL error (used to use URL but certificates expired).&amp;nbsp; Being able to see the output to terminal in the log helps as well. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate your time!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 18:24:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unix-X-Command-Exit-Code-Retrieval-for-curl-command/m-p/136724#M27668</guid>
      <dc:creator>cjinsf</dc:creator>
      <dc:date>2013-11-22T18:24:00Z</dc:date>
    </item>
  </channel>
</rss>

