1

I have to read data from an archaic fixed-width table. Some of the fields are in the IBM packed decimal Format, and I have no idea how to get the numbers.

for example, one line of my Input file might look like this:

140101   72      ‘ëm§11  

where ‘ëm§1 is actually the packed decimal representation of the number 3153947. SAS can read this field correctly via INPUT gew pd4.4

Anyone any expericnes with this issue?

Joe
  • 62,789
  • 6
  • 49
  • 67
Stefan F
  • 2,573
  • 1
  • 17
  • 19
  • What a terrible format. You may need to write the conversion code yourself. It shouldn’t be too hard but I don’t manage to convert the input you’ve shown (are you sure your input is valid? The last nibble should be either 0xF or 0xD, but it’s 0x3); conversely, it works with the example given [in the documentation](https://publib.boulder.ibm.com/iseries/v5r1/ic2924/books/c0925083170.htm). – Konrad Rudolph May 11 '16 at 15:24
  • 1
    Expanding further upon my first comment, what program are you using to look at the input? The packed decimal number uses byte values whose character representation depends on the chosen encoding. The characters you’ve shown don’t seem to correspond to the number you’ve shown, which would require four bytes to encode in the PD format, and I know of no character encoding which could yield your string output given that number of bytes. – Konrad Rudolph May 11 '16 at 15:45
  • Thank you for the Information, it confirms my own Research. I think it very likely that the files do not get correctly transferred from the mainframe (we use ftp for that). Initially I thought SAS uses the same file, so it must work; but now i figured out that SAS really accesses the original file on the mainframe. Do you know any sensible way to transfer packed decimal data from an IBM mainframe without screwing it up? – Stefan F May 12 '16 at 07:26
  • Unfortunately I've got no idea. I've never worked with mainframe computers. – Konrad Rudolph May 12 '16 at 07:41
  • Hmm thanks anyways, I somehow fear that the Problem cannot really be solved from within R :/ – Stefan F May 12 '16 at 07:48

0 Answers0