read COBOL index file with perl

Discussion in 'Perl Misc' started by Gabkin, Jul 5, 2004.

  1. Gabkin

    Gabkin Guest

    I need to parse a COBOL index file using a perl script.
    I don't know _that_ much about COBOL but it seems the index file is
    written in some kind of binary format, its not ASCII, thats for sure!

    Has this been done before?
    Is there an existing library I can use for this?

    failing that...
    Does anyone know how COBOL writes its index files and how I could go
    about parsing them with perl?
    Or is there a simple way to read and parse binary style data?
     
    Gabkin, Jul 5, 2004
    #1
    1. Advertising

  2. Gabkin

    John Bokma Guest

    Gabkin wrote:

    > I need to parse a COBOL index file using a perl script.
    > I don't know _that_ much about COBOL but it seems the index file is
    > written in some kind of binary format, its not ASCII, thats for sure!
    >
    > Has this been done before?
    > Is there an existing library I can use for this?
    >
    > failing that...
    > Does anyone know how COBOL writes its index files and how I could go
    > about parsing them with perl?
    > Or is there a simple way to read and parse binary style data?


    perldoc -f read
    perldoc -f unpack
    perldoc -f binmode

    <http://search.cpan.org/search?mode=all&query=COBOL> gave:
    <http://search.cpan.org/~grommel/Convert-IBM390-0.18/IBM390.pm>
    "A COBOL EXAMPLE"

    <http://www.google.com/search?q=COBOL+%22index+file%22+specification>
    <http://myfileformats.com/search.php?cat_id=170&cat_name=Miscellaneous&start=1>
    Ryan McFarland (RM-COBOL) Index File layout

    Might be helpful.

    --
    John MexIT: http://johnbokma.com/mexit/
    personal page: http://johnbokma.com/
    Experienced Perl programmer available: http://castleamber.com/
    Happy Customers: http://castleamber.com/testimonials.html
     
    John Bokma, Jul 5, 2004
    #2
    1. Advertising

  3. Gabkin

    Anno Siegel Guest

    Gabkin <> wrote in comp.lang.perl.misc:
    > I need to parse a COBOL index file using a perl script.
    > I don't know _that_ much about COBOL but it seems the index file is
    > written in some kind of binary format, its not ASCII, thats for sure!
    >
    > Has this been done before?
    > Is there an existing library I can use for this?
    >
    > failing that...
    > Does anyone know how COBOL writes its index files and how I could go
    > about parsing them with perl?
    > Or is there a simple way to read and parse binary style data?


    There is (see "perldoc -f pack" and "perldoc -f unpack"), but you got
    to know the style. I have no idea what an index file is in COBOL,
    but it's quite possible that the format depends on the particular
    system and compiler.

    Anno
     
    Anno Siegel, Jul 5, 2004
    #3
  4. Gabkin <> wrote:

    > I need to parse a COBOL index file using a perl script.
    > I don't know _that_ much about COBOL but it seems the index file is
    > written in some kind of binary format, its not ASCII, thats for sure!
    >
    > Has this been done before?



    Google Groups is your friend:

    http://groups.google.com/groups?as_q=Cobol&as_ugroup=comp.lang.perl.misc


    > Is there an existing library I can use for this?



    CPAN is your friend:

    http://search.cpan.org/search?query=cobol&mode=all


    > Does anyone know how COBOL writes its index files



    Usenet is your friend:

    comp.lang.cobol

    Which leads you to your new friend, Google Groups, again:

    http://groups.google.com/groups?as_epq=index file&as_ugroup=comp.lang.cobol


    > and how I could go
    > about parsing them with perl?



    perldoc -f pack
    perldoc -f unpack
    perldoc -f seek
    perldoc -f read


    > Or is there a simple way to read and parse binary style data?

    ^^^^^^

    The Perl FAQ is your friend:

    perldoc -q binary

    How do I handle binary data correctly?
    How do I randomly update a binary file?


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Jul 5, 2004
    #4
  5. Gabkin

    Gabkin Guest

    <selective snippings>
    >>Has this been done before?


    > Google Groups is your friend:
    >
    > http://groups.google.com/groups?as_q=Cobol&as_ugroup=comp.lang.perl.misc
    >
    >>Is there an existing library I can use for this?

    >
    >
    > CPAN is your friend:
    >
    > http://search.cpan.org/search?query=cobol&mode=all
    >
    >>Does anyone know how COBOL writes its index files

    >
    > Usenet is your friend:
    >
    > comp.lang.cobol
    >
    > Which leads you to your new friend, Google Groups, again:
    >
    > http://groups.google.com/groups?as_epq=index file&as_ugroup=comp.lang.cobol
    >
    >>Or is there a simple way to read and parse binary style data?

    >
    > ^^^^^^
    >
    > The Perl FAQ is your friend:
    >
    > perldoc -q binary
    >
    > How do I handle binary data correctly?
    > How do I randomly update a binary file?
    >
    >


    Wow, whatalot of friends I've got!


    Thanks, will check out those sources.
     
    Gabkin, Jul 5, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ferro
    Replies:
    7
    Views:
    14,663
    Dave Monroe
    Oct 29, 2003
  2. Batista, Facundo

    How to read files written with COBOL

    Batista, Facundo, May 10, 2004, in forum: Python
    Replies:
    7
    Views:
    1,209
    Buck Nuggets
    May 14, 2004
  3. Batista, Facundo

    RE: How to read files written with COBOL

    Batista, Facundo, May 10, 2004, in forum: Python
    Replies:
    1
    Views:
    530
    Steve Holden
    May 10, 2004
  4. none
    Replies:
    2
    Views:
    614
    Dennis Lee Bieber
    Sep 22, 2005
  5. Tomasz Chmielewski

    sorting index-15, index-9, index-110 "the human way"?

    Tomasz Chmielewski, Mar 4, 2008, in forum: Perl Misc
    Replies:
    4
    Views:
    335
    Tomasz Chmielewski
    Mar 4, 2008
Loading...

Share This Page