Hello, I'm trying to FTP data from a local PC SAS data set onto a z/OS mainframe flat file. I'm able to use the FILENAME statement to FTP the data, but it's not in the right format. I've tried changing the formats of the data in the data set, but it keeps looking like junk data. However, if I view the data with ASCII data encoding, I can see that the data's there, but just in a different format. Also, if I FTP the data manually from a text file through Filezilla (transferring as ASCII) it works like a charm. Here's the top of the data viewed with ASCII:
**COMPRESSED** **COMPRESSED** **COMPRESSED** **COMPRESSED** **COMPRESSED
LIB CONTROL W32_7PRO¼ SAS9.4¼
It seems to me like it's posting some of the data set's meta data or something? Here's the data set with the FILENAME FTP, and the PROC CPORT to get it onto the mainframe:
data RTR3;
set RTR2;
d=strip(a||date||c);
keep d;
run;
FILENAME RTR3 FTP "'TEST.RTR.TAB21.RTR3'"
Host = 'atrsyse'
User = "&user" Pass = "&pass" Rcmd = 'ascii';
PROC CPORT DATA = RTR3 FILE = RTR3;
RUN;
Version 9.4 on PC and mainframe.
The beginning of that file makes it look like a SAS export file. If so then it is a BINARY file even though the beginning of it looks like text. If you transfer it as ASCII (or text) to an IBM mainframe then it will be converted to EBCDIC and the content will be unreadable.
You need to FTP the CPORTed file using the BINARY option to a z/OS file that has LRECL set to 80 and BLKSIZE to 8000. PROC CIMPORT on z/OS requires an ASCII-formatted file hence the need to use BINARY to retain this format.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.