I have a bunch of data files along with COBOL copybooks. I need to convert these COBOL data files to ascii. I suspect I'll need to use pack/unpack to get at these data, but I don't have the foggiest notion where to begin. I do have perlpacktut and Pack/Unpack Tutorial, I have not read them as yet but will start as soon as I finish this post.

The copybooks I have look like this:

01 CLASS-OUT. 05 CCNUM-OUT PIC X(14). 05 CCDESC-OUT PIC X(40). 05 CL-OUT PIC X(14). 05 CLDESC-OUT PIC X(38).
or
01 MASTER-OUT REDEFINES HEADER-RECORD. 05 CC-NUMBER PIC 9(04). 05 MTD-UNITS PIC S9(07). 05 MTD-DOLLARS PIC S9(09). 05 INV-ON-HAND PIC S9(07).
I also have a COBOL reference that tells me that 'PIC X(14).' tells me that the data field is a 14-byte alpha-numeric field and that PIC S9(07) is a 7-byte signed integer. I'm just not sure how to get Perl to pass this as ascii.

I would really appreciate any suggetions on how to start.

Thanks!!!

Update: This is on an HP-UX with Perl 5.6.1

Sweetblood


In reply to COBOL to ascii conversions by sweetblood

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.