Ok, I posted some stuff about this, but it never showed up. I'll try again here and maybe this will get posted.

I'm working on a module that will read a COBOL "copylib" member file. This would contain only "DATA DIVISION" COBOL, but could include multiple "01" level records. The module will then read a data file, and allow you to access the data using the COBOL names, do data processing, write out the data to a different or the same file, etc.

I've got some working code, but I've never done a CPAN-type module before, so it may take some time to figure that out. The module basically will allow you to do stuff like this:

$cobolRecs = new COBOLIO::COBOLRecs(); $cobolRecs->CreateRecs("cobol_copy_1.txt"); open(COBOLDATA, "datafile.txt"); while(<COBOLDATA>) { $cobolRecs->ReadRecInto($_, "BIG_COBOL_RECORD_NAME"); if($cobolRecs->{EMPLOYEE_NUMBER} < 5000) { print "Retirement imminent for $cobolRecs->{EMPLOYEE_NAME}\n"; } }
The assumption here is that you are working on a micro, with files in ASCII format. I've included code do deal with signed numerics, but not packed decimal. I could use some assistance modularizing and refactoring, if anyone is interested. If anyone has other suggestions on what the module should do, please reply. Thx... HH Harry

In reply to Re: How do I manipulate COBOL data? by Anonymous Monk
in thread How do I manipulate COBOL data? by mAsterdam

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.