|Keep It Simple, Stupid|
COBOL Layout parsingby broomberg (Initiate)
|on Mar 29, 2002 at 03:01 UTC||Need Help??|
broomberg has asked for the
wisdom of the Perl Monks concerning the following question:
O glorious ones.
Ok, enough ass kissing.
I'm not a newbie, but sure feel like it. I'd like to know if there is any Perl package that deal with COBOL layout conversions.
I've wrote a few attempts over the years, but everytime I have one working for one project, it seems that the next project's layout if different enough to trigger a rewrite. I obviously don't know enough about COBOL (and would like to keep wallowing in my ignorance if possible) to write a generic layout parser which includes data conversion.
Here are the issues I am trying to deal with:
EBCDIC -> ASCII - Can't use 'dd' since I only want to convert non comp fields.
Comp fields, depending on which machine (endian wise) the data comes from.
88 levels for validation.
I've used the EBCDIC Perl libs which seem to work (but SLOW). I've actually split out the binary vs text data in the past, ran the text through a 'dd' conversion to ASCII and then joined the binary back in, and then attempted to deal with the comp field via varous unpack hacks. Twas nasty.
Redefines a another killer. I used to the in 'C' unions, so I understand them, but I have a tough time twisting them into Perl style hash ref records.
So, is this here (CPAN, etc) already and I simply missed it?
Also, due to data size, is this even reasonable? I may have to convert 500 million records on an on-going monthly basis. Should I accept the fact I'll need a hardcoded solution and just go from there?