Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

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:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Microfocus Cobol datafiles
by pboin (Deacon) on Feb 03, 2006 at 13:58 UTC


    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 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 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?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (1)
As of 2021-10-22 00:50 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (85 votes). Check out past polls.