BookmarkSubscribeRSS Feed
MaryPet123
Calcite | Level 5

Hello All,

Looking for some assistance with the SFTP processing in SAS. We have a requirement to use secure FTP to read SMF data from a mainframe lpar. Our jobs are initiated from a windows PC and the standard FTP in SAS works fine however when we attempt to read same file using SFTP we get errors on the PASS and RCMD commands. Attempting to run this without those two commands does not work either. Has anyone managed to get this to work? The file is variable block spanned and sometimes resides on TAPE (albeit virtual) so additional parameters may be required as well but we have not been able to get any to work. 

Any assistance is appreciated.

Sample Code: 


FILENAME SMF SFTP ("'XXX.XXX.XXX.G0037V00'")
USER='USER123' HOST='102.102.1.102' DEBUG
S370VS RCMD='SITE RDW;SITE READTAPEFORMAT=S' LRECL=32760
PASS='Passw@rd';

3 REPLIES 3
ballardw
Super User

Doesn't work is awful vague.

Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.

No output? Post any log in a code box.

Unexpected output? Provide input data in the form of a dataset, the actual results and the expected results. Data should be in the form of a data step. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

Kurt_Bremser
Super User

SFTP from SAS needs public/private key authentication, so the connection is established without a password. Since SAS uses an external SFTP client for the transfer, establish passwordless authentication there first, and then try from SAS again.

Kurt_Bremser
Super User

And an addendum: the SFTP protocol does not support all messages/commands found in the FTP protocol. Therefore certain options like RCMD are not available when using sftp.

So a sideeffect of switching to SFTP on the mainframe might be that you need to convert files to a format suitable for SFTP before you try to read them from SAS. eg FB so you can read with recfm=f and a suitable lrecl=.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1899 views
  • 0 likes
  • 3 in conversation