http://www.perlmonks.org?node_id=696456

plegall has asked for the wisdom of the Perl Monks concerning the following question:

My EBCDIC and COBOL skills are very low, I'm new to this old technology.

I have some COBOL records EBCDIC encoded files. Each file is a list of records. I want to convert it into a Perl data structure, perform some transformations on fields, convert back to COBOL data structure and EBCDIC encoding.

I've found the Convert::EBCDIC CPAN module of course, but the COBOL record definition is not obvious for me : I don't understand how to jump from the COBOL definition to the unpackeb pattern :-/ Prior to this field extraction, I don't understand how to extract lines from the file !

My COBOL definition is:

01 BCOM. 05 FILLER-ASCII PIC X(292). 05 FILLER-EBCDIC1 PIC 9(8) COMP. 05 FILLER-EBCDIC2 PIC 9(8) COMP.

what should the pattern be to unpack fields?

Convert::EBCDIC module on CPAN