<?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: Reading data from mainframe via ftp in Foundation SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-mainframe-via-ftp-in-Foundation-SAS/m-p/91747#M19369</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can consider using PROC PWENCODE. See &lt;A href="http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#n1vzmasf0tdebfn1xec0k1tevq7q.htm" title="http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#n1vzmasf0tdebfn1xec0k1tevq7q.htm"&gt;Base SAS(R) 9.3 Procedures Guide, Second Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Sep 2013 16:00:48 GMT</pubDate>
    <dc:creator>CTorres</dc:creator>
    <dc:date>2013-09-24T16:00:48Z</dc:date>
    <item>
      <title>Reading data from mainframe via ftp in Foundation SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-mainframe-via-ftp-in-Foundation-SAS/m-p/91746#M19368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I’ve written a Foundation SAS program which retrieves data repeatedly (34 times in total) from an IBM Mainframe via ftp. In order to do this, I use a Filename statement like the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;%Let Username = ‘JohnB’;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;%Let Password = ‘passw’;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;Filename FileRef ftp &amp;amp;MainframeFile Host=&amp;amp;Host User=&amp;amp;Username Pass=&amp;amp;Password Debug lrecl=&amp;amp;RecLength recfm=f;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While testing, I hard-coded the password in the program to save time. Since the password then appears in the Log, I’ve removed the password and changed the Filename statements in the program as follows: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;%Let Username = ‘JohnB’;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;Filename FileRef ftp &amp;amp;MainframeFile Host=&amp;amp;Host User=&amp;amp;Username Prompt Debug lrecl=&amp;amp;RecLength recfm=f;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This new approach means that the user has to type in his/her password manually, and it will be printed to the Log as a string of X’s. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, this approach means that the user will be asked for his/her password 34 times when the program is run. Is there a way in SAS to only pass the password through to the mainframe via ftp just once, even though multiple ftp statements are used? Or is it possible to not have the password written to the Log? Is there an option in SAS that doesn't write certain statements to the Log? This would mean taking the statement &lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;%Let Password = ‘passw’ &lt;/SPAN&gt;and &lt;EM&gt;not&lt;/EM&gt; writing that to the Log. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Sep 2013 15:12:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-mainframe-via-ftp-in-Foundation-SAS/m-p/91746#M19368</guid>
      <dc:creator>mediaeval</dc:creator>
      <dc:date>2013-09-24T15:12:18Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from mainframe via ftp in Foundation SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-mainframe-via-ftp-in-Foundation-SAS/m-p/91747#M19369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can consider using PROC PWENCODE. See &lt;A href="http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#n1vzmasf0tdebfn1xec0k1tevq7q.htm" title="http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#n1vzmasf0tdebfn1xec0k1tevq7q.htm"&gt;Base SAS(R) 9.3 Procedures Guide, Second Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Sep 2013 16:00:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-mainframe-via-ftp-in-Foundation-SAS/m-p/91747#M19369</guid>
      <dc:creator>CTorres</dc:creator>
      <dc:date>2013-09-24T16:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from mainframe via ftp in Foundation SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-mainframe-via-ftp-in-Foundation-SAS/m-p/91748#M19370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The real issue of pwencode is that the source code you can still copy/paste that and it will work.&amp;nbsp; &lt;/P&gt;&lt;P&gt;By that everyone is able to used that once having copied it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using pwencode will solve just the incidental seeing as dificult to remember.&lt;/P&gt;&lt;P&gt;It will be reversed by SAS to its original value before sending out. As SAS is able to do that someone else could do that also.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What can be done is a dynamic part in the SAS source solving it at the moment when needed.&lt;/P&gt;&lt;P&gt;Where must your key-password come from? My suggestion would be a password encrypted file belonging to the data/key running the needed process.&lt;/P&gt;&lt;P&gt;Sounds posssible complex but can be solved with a SAS macro.&amp;nbsp; Need a sample? Watch the read-key value needing to be the same.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H5&gt;Sample to create SAS dataset&lt;/H5&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="sassrc"&gt;Data lib.keypswd (read=P1jkU7r write=secret-me alter=secret-me) ; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; length id $ 16 keypsw $ 32 ; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; id="orion" ; keypsw="test app" ; output; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; id="PMIB" ; keypsw='user="P_RSI_CI" pw="Z75AftgTb"' ;output; &lt;BR /&gt;run; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H5&gt;Sample SAS macro:&lt;/H5&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="sassrc"&gt;/* * * xkeypswd * * * */ &lt;BR /&gt;/* * * read personal key-pswd to acess external dbms * * * */ &lt;BR /&gt;/* * * written by:jakarman * * * */ &lt;BR /&gt;/* * * designed 2007 (8.2) converted 2012 (9.-) * * * */ &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro xkeypsw (mainarg,opt,readvl=P1jkU7r,keypswfl=lib.keypswd) ;&lt;BR /&gt;%local larg lind xkeypswdret ;&lt;BR /&gt;%let opt =%lowcase(&amp;amp;opt) ;&lt;BR /&gt;%let larg=%length(&amp;amp;mainarg) ;&lt;BR /&gt;%let lopt=%length(&amp;amp;opt) ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let xkeypswdret=;&lt;BR /&gt;%if ( %index(&amp;amp;opt,HELP) &amp;gt;0 | %index(&amp;amp;opt,?) &amp;gt;0 | %index(&amp;amp;mainarg,?) &amp;gt;0 ) %THEN %do ;&lt;BR /&gt;%* (insert your comment as copied this sample source) ;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let xkeypswdret=help &lt;BR /&gt;text given ;&lt;BR /&gt;%end ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if ( %length(&amp;amp;xkeypswdret) = 0) %then %do ; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %let keydsid=%sysfunc(open(&amp;amp;keypswfl ( read=&amp;amp;readvl where=( id = "&amp;amp;mainarg") ) ,i )); &lt;BR /&gt;&amp;nbsp;&amp;nbsp; %if (&amp;amp;keydsid = 0) %then %put %sysfunc(sysmsg()); &lt;BR /&gt;&amp;nbsp;&amp;nbsp; %else %do ; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let rc=%sysfunc(fetch(&amp;amp;keydsid )); &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if ( &amp;amp;rc ne 0) %then %put %sysfunc(sysmsg()) ; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let pw=%sysfunc(getvarc(&amp;amp;keydsid,%sysfunc(varnum(&amp;amp;keydsid,keypsw)))) ; &lt;BR /&gt;&amp;amp;pw &lt;BR /&gt;&amp;nbsp;&amp;nbsp; %end ; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; %if ( &amp;amp;keydsid &amp;gt; 0 ) %then %let rc=%sysfunc(close(&amp;amp;keydsid)) ; &lt;BR /&gt;%end; &lt;/P&gt;&lt;P&gt;%mend ; &lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Sep 2013 18:06:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-mainframe-via-ftp-in-Foundation-SAS/m-p/91748#M19370</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2013-09-24T18:06:25Z</dc:date>
    </item>
  </channel>
</rss>

