DATA Step, Macro, Functions and more

How to convert packed decimal to text ?

Reply
Contributor oht
Contributor
Posts: 25

How to convert packed decimal to text ?

Hi,

We have ftp a file that contains paked decimal from Mainframe(MVS- no SAS) to unix using 'EXEC PGM=FTP'. Is there any way to convert the packed decimal to numeric or char in Unix ?

Thanks

Super User
Posts: 5,099

Re: How to convert packed decimal to text ?

It's probably relatively easy.

Can you provide a few examples of what the data look like after being transferred (hex codes, please), and what values they should become?

Super User
Super User
Posts: 6,502

Re: How to convert packed decimal to text ?

Just make sure to move the file as BINARY and not ASCII with FTP.

Then you should be able to read it with SAS using PD informat.

Contributor oht
Contributor
Posts: 25

Re: How to convert packed decimal to text ?

We did try to ftp in binary format and then use the SAS PD to read in the data. However, the pack decimal vaules all become missing.values.

We finally able to convert the pd to flat file with COBALT and then FTP and it works

Tom,Astounding, really thanks for your help

Valued Guide
Posts: 2,175

Re: How to convert packed decimal to text ?

For future reference, PD OFF-mvs is not the same as PD ON-mvs

To read data in binary mvs PD format use the informat S370FPD.

There are several of these S370Fxxx formats designed to help with the task of reading ebcdic data (as well as $ebcdic itself)

not S3270FPD ( 3270 is an IBM terminal data ) Message was edited by: Peter Crawford

Contributor oht
Contributor
Posts: 25

Re: How to convert packed decimal to text ?

Thanks Peter, I am sorry I get confused with 'PD OFF-mvs is not the same as PD ON-mvs'  ? Do you mean I can read in the MVS PD data in unix using informat S370FPD if the file was FTP in binary ?

Super User
Super User
Posts: 6,502

Re: How to convert packed decimal to text ?

That is what he meant.  There are a number of useful formats/informats that should allow you to both read and write data that can be moved to/from IBM mainframe.   For example I was just using the S370FIB to write binary integers with the byte order in the direction I wanted.

Valued Guide
Posts: 2,175

Re: How to convert packed decimal to text ?

Thank you Tom

That is what I intended.

OHt

There are also some very useful papers on the support.sas.com website on the topic.

Peter

Ask a Question
Discussion stats
  • 7 replies
  • 2226 views
  • 0 likes
  • 4 in conversation