Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Microfocus Cobol datafiles

by RicardoPortilho (Novice)
on Feb 03, 2006 at 13:26 UTC ( #527626=perlquestion: print w/ replies, xml ) Need Help??
RicardoPortilho has asked for the wisdom of the Perl Monks concerning the following question:

How can I open this files?
I believe it is possble someway, maybe with the DBI way.


Thanks in advance.

Comment on Microfocus Cobol datafiles
Re: Microfocus Cobol datafiles
by blazar (Canon) on Feb 03, 2006 at 13:57 UTC

    Open? With open, maybe?

    Have you tried searching CPAN for a specific module, hoping that one exists?

Re: Microfocus Cobol datafiles
by pboin (Deacon) on Feb 03, 2006 at 13:58 UTC

    Ricardo:

    We'll need a lot more information than that.

    1) Where were the files created?

    2) Are you trying to read them on the same system or a different one?

    3) Any error messages?

    4) Sample code would be nice.

    5) What have you tried so far?

    PerlMonks is the most helpful place on the 'net. But, you have to do your fair share by asking good questions. Read this: How (Not) To Ask A Question

      CPAN doensn´t show anything about Microfocus or Cobol, od .CAD in DBI.
      This files are already created, and each one is like a table, with fields and records. Their names are like CLIENTS.CAD and CITY.CAD.
      People where I work open, read and write in them, with Cobol. I´m sure Perl would be faster to code on these.
        Can you post sample data files for us to look at? (No actual customer or employee information please.)
Re: Microfocus Cobol datafiles
by inman (Curate) on Feb 03, 2006 at 15:01 UTC

      I'm not willing to read the whole document about COBOL format, but for registries with fixed size you will probably want to use pack and unpack. For variable size, you can use split, regular expressions and subtr to do the job.

      Once you have the abstraction to make the code smart enough to figure out which kind of format it uses, maybe you will want to write a module that reads the file and parses it in an easier way

      Alceu Rodrigues de Freitas Junior
      ---------------------------------
      "You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill
Re: Microfocus Cobol datafiles
by kutsu (Priest) on Feb 03, 2006 at 17:08 UTC

    The first link returned searching for Cobol on search.cpan is Convert::IBM390 which includes an example for reading a Cobol datafile (not sure what a .cad is though). If you want to read the data printed by the datafile simply set the fd with a filler (see below) then set the filler as a comma or pipe (or other delimiter) and super search for reading from a comma delimited file.

    fd data-file LABEL RECORDS ARE STANDARD DATA RECORD IS data-rec. 01 data-rec. 05 data-foo pic 9(05). 05 data-filler1 pic X(01). 05 data-bar pic X(15). 05 data-filler2 pic X(01). * etc....

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://527626]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2014-07-23 20:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (152 votes), past polls