Hi all
I am trying to read a tab delimited file from Mainframes in AIX via SAS FTP. I am using the following FILENAME statement:
FILENAME FTP TEST "'TEST.FILENAME.ABC'" HOST="HSSS.SYS.XYZ.COM" USER="USERN" PASS="PASSWORD";
DATA TEST;
INFILE TEST DLM='05'X DSD MISSOVER TRUNCOVER;
INPUT YEAR $4
M0 $2
NAME $4
CODE $6;
RUN;
I am using these statements inside Unix (AIX). The DLM statements seem to have no effect while reading. Here '05'x refers to hexa value of tab in EBCDIC (Mainframes). I tried using '09'x as well as hexa is represented by '09'x in ASCII (Unix).
But none of them seem to have effect on the input file.
Is anyone aware of reading tab delimited files via FTP from Mainframes on Unix.
Any help in this regard would be highly appreciated.
Thanks.
If you are reading a delimited file you should not use formatted input style as it could read right past the delimiter or stop short and throw off breaking the line up at the delimiters. Unless you specify BINARY on the FTP then the file will be converted to ASCII, since you are reading the character variables as ASCII instead of EBCDIC then you should use '09'x for the delimiter. There is almost never a case when you want to use MISSOVER option instead of the TRUNCOVER option. Plus your code is not using it anyway as you have overridden it by adding the TRUNCOVER option.
DATA TEST;
INFILE TEST DLM='09'X DSD TRUNCOVER;
LENGTH YEAR $4 M0 $2 NAME $4 CODE $6 ;
INPUT YEAR M0 NAME CODE ;
RUN;
First look at what is actually in the file. Add a LIST statement after the INPUT and SAS will show you what it has received. Any non printable characters such as a tab will cause SAS to list the actual hex values of the characters.
RULE: ----+----1----+----2----+----3
1 CHAR Alfred.M.14.69.112.5 20
ZONE 46676604033033033323
NUMR 1C62549D9149699112E5
2 CHAR Alice.F.13.56.5.84 18
ZONE 466660403303323033
NUMR 1C93596913956E5984
3 CHAR Barbara.F.13.65.3.98 20
ZONE 46766760403303323033
NUMR 212212196913965E3998
NOTE: 3 records were read from the infile TMPFILE2.
If you are reading a delimited file you should not use formatted input style as it could read right past the delimiter or stop short and throw off breaking the line up at the delimiters. Unless you specify BINARY on the FTP then the file will be converted to ASCII, since you are reading the character variables as ASCII instead of EBCDIC then you should use '09'x for the delimiter. There is almost never a case when you want to use MISSOVER option instead of the TRUNCOVER option. Plus your code is not using it anyway as you have overridden it by adding the TRUNCOVER option.
DATA TEST;
INFILE TEST DLM='09'X DSD TRUNCOVER;
LENGTH YEAR $4 M0 $2 NAME $4 CODE $6 ;
INPUT YEAR M0 NAME CODE ;
RUN;
Awesome! It worked perfect! So insightful! Thank you!
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.