BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DeepSiv
Fluorite | Level 6

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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;

View solution in original post

3 REPLIES 3
Tom
Super User Tom
Super User

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.

Tom
Super User Tom
Super User

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;

DeepSiv
Fluorite | Level 6

Awesome! It worked perfect!  So insightful! Thank you!

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 13886 views
  • 0 likes
  • 2 in conversation