[thelist] Binary file manipulation in PHP
Luther, Ron
Ron.Luther at hp.com
Thu Feb 14 08:11:27 CST 2008
Rick den Haan noted:
>>For reference, I tried changing the character set, as Ron suggested, to a lot
>>of different types, but all of them gave me various incarnations of gibberish.
>>unpack() appears to solve my problem.
Hi Rick,
I'm glad you are making progress. ;-)
Sorry, I thought your original note said that you had a 'VERY' detailed
file spec. I assumed that you meant that the spec already told you which
fields were 'zone packed decimal' or 'multi-punch column binary' - which,
if this data is really *that* old are format types you could easily run into.
If you are going to have to _guess_ at each of the field types then I think you
are in for some very long days. [1]
Anyway here is a link that may help as a starting point to enjoying old BCD
and COBOL "comp-3" fields and how they can differ from old IBM signed fields:
http://www.3480-3590-data-conversion.com/article-packed-fields.html
It also throws a number of keywords at you that you can google for more info.
Good Luck!
RonL.
[1] Especially if you don't know the underlying system the data came from.
I would check around to be sure but I would not assume that a 'packed' field
pulled off an old Univac machine could be properly decoded with an 'unpack'
function pulled off an old Honeywell machine. I think there might be a potential
for vendor specific implementations.
More information about the thelist
mailing list