I have a file that was formerly an EBCDIC-encoded file, which was converted to ASCII using dd. However, some lines contain COMP-3 packed fields which I would like to read.
For example, the string representation of one of the lines I would like to decode is:
'15\x00\x00\x00\x04@\x00\x00\x00\x00\x0c\x00\x00\x00\x00\x0c777093020141204NNNNNNNNYNNNN\n'
The field I would like to read is specified by PIC S9(09) COMP-3 POS. 3
, that is, the field that starts with the third byte and is nine bytes long when decoded (and therefore, five bytes long when encoded, according to the COMP-3 spec).
I understand the COMP-3 spec and I also know that for this particular line the integer value of this field should be 315
, but I can't figure out what to do in order to actually decode the field. I'm also not sure if the fact that the file was converted with dd
to ASCII is a problem here or not.
Has anyone worked on a similar issue before, or is there something obvious I'm missing? Thank you!