I want to access a SAS dataset on an IBM mainframe, from Foundation SAS on my PC. I have successfully used ftp in the past to read text files from the mainframe, with code as follows:
Filename filex ftp "'pr.ap.s010.g0133'" Host="oat1" User="joec" pass='mypass' debug lrecl=1251 recfm=f;
Data Stuff;
infile filex;
input @1 var1 $ebcdic8.;
Run;
Can I employ something similar to read SAS datasets from the Mainframe...what's the best way to do that? The SAS library on the mainframe is called EU.OBTEMP.SASBASE and the dataset in there is called shpr.
Thanks
Joe
Hi:
Some additional information would be helpful...
- do you have SAS on the mainframe as well?
- do you have SAS CONNECT installed?
- do you have a SAS Spawner on the mainframe?
These tools simplify the process of accessing or uploading and downloading files of SAS data from mainframes.
Hi
Yes, SAS is on the mainframe.
When I run Proc Setinit on my PC, Connect dose not appear in the list of licensed products, so I assume I do not have it. I don't know if the Mainframe is licensed for Connect.
I do not know if there is a SAS Spawner on the mainframe (I've never even heard the term before, I don't have much involvement with mainframe).
Thanks
Joe
I think the only option for you is to download the file from the mainframe to the PC. Do you use TSO on the PC to access your mainframe as well? If so you can use it to download the SAS file but I think there might be conversion issues. (I haven't done this stuff in years....)
I think you need to download the SAS dataset in binary, or create a transportable copy using PROC EXPORT.
I would check out the CPORT and CIMPORT procedures. You need to CPORT the SAS dataset on the mainframe, FTP it to your PC using the BINARY option, then use CIMPORT to read it into SAS on your PC. From memory I think you have to create the CPORT file with a particular record and blocksize, which you should be able to find in the SAS documention (something like RECFM = FB LRECL = 80).
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.