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
| [reply] [Watch: Dir/Any] |
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.
| [reply] [Watch: Dir/Any] |
Can you post sample data files for us to look at? (No actual customer or employee information please.)
| [reply] [Watch: Dir/Any] |
| [reply] [Watch: Dir/Any] |
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
| [reply] [Watch: Dir/Any] [d/l] [select] |
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....
| [reply] [Watch: Dir/Any] [d/l] |
Open? With open, maybe?
Have you tried searching CPAN for a specific module, hoping that one exists?
| [reply] [Watch: Dir/Any] |