BookmarkSubscribeRSS Feed
BrianT
Calcite | Level 5

Hi!

I'm running into some oddities using the encoding option.  I'm trying to download IBM mainframe data into a UNIX SAS environment, and am running into trouble with packed decimals.

When I run the following code --

filename rawdata ftp

("'MYFILE'")

host="myhost"

user=&user

pass=&pass

lrecl=73

recfm=F

debug ;

DATA WORK.SrcFile_Binary ;

    format PDecimal               best32.;

  INFILE RAWDATA EOV=FILEEND;

INPUT

       @07 PDecimal                     S370FPD08.00

       @ ;

RUN ;

I get valid values for PDecimal.

However, when I write it using the ENCODING= option..

filename rawdata ftp

("'MYFILE'")

host="myhost"

user=&user

pass=&pass

lrecl=73

recfm=F

    encoding=EBCDIC

debug ;

DATA WORK.SrcFile_Native ;

    format PDecimal               best32.;

  INFILE RAWDATA EOV=FILEEND;

INPUT

       @07 PDecimal                    PD08.00

       @ ;

RUN ;

The query does NOT return valid values.

I've tried several different informats, including PD08.00, FPD08.00, etc.

As an example, here's the binary version of one number.

0x031500750025292C

This should be transcoded to "31500920003150", but I can't find the command to make that happen.  Note that character columns work fine.

Any help you can give would be appreciated!

1 REPLY 1

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1 reply
  • 408 views
  • 0 likes
  • 2 in conversation