DATA Step, Macro, Functions and more

SFTP - reading mainframe files from Windows PC

Reply
Occasional Contributor
Posts: 5

SFTP - reading mainframe files from Windows PC

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';

Super User
Posts: 11,343

Re: SFTP - reading mainframe files from Windows PC

Posted in reply to MaryPet123

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.

Super User
Posts: 7,853

Re: SFTP - reading mainframe files from Windows PC

Posted in reply to MaryPet123

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Posts: 7,853

Re: SFTP - reading mainframe files from Windows PC

Posted in reply to MaryPet123

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=.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 3 replies
  • 149 views
  • 0 likes
  • 3 in conversation