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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.