Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > read COBOL index file with perl

Reply
Thread Tools

read COBOL index file with perl

 
 
Gabkin
Guest
Posts: n/a
 
      07-05-2004
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?
 
Reply With Quote
 
 
 
 
John Bokma
Guest
Posts: n/a
 
      07-05-2004
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
 
Reply With Quote
 
 
 
 
Anno Siegel
Guest
Posts: n/a
 
      07-05-2004
Gabkin <(E-Mail Removed)> 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
 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      07-05-2004
Gabkin <(E-Mail Removed)> 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...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_e...omp.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
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Gabkin
Guest
Posts: n/a
 
      07-05-2004
<selective snippings>
>>Has this been done before?


> Google Groups is your friend:
>
> http://groups.google.com/groups?as_q...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_e...omp.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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sorting index-15, index-9, index-110 "the human way"? Tomasz Chmielewski Perl Misc 4 03-04-2008 05:01 PM
Code to read Cobol data files none Python 2 09-22-2005 07:38 AM
How to read files written with COBOL Batista, Facundo Python 7 05-14-2004 03:16 AM
RE: How to read files written with COBOL Batista, Facundo Python 1 05-10-2004 10:02 PM
Read COBOL database (DAT, IDX) with JDBC Ferro Java 7 10-29-2003 01:05 PM



Advertisments