http://www.perlmonks.org?node_id=134448

prgeorge has asked for the wisdom of the Perl Monks concerning the following question:

Hi, All most all the legacy data is in VSAM files.How can I read those. Thanks Roy

Replies are listed 'Best First'.
Re: How can I read Vsam files.
by Corion (Patriarch) on Dec 26, 2001 at 22:21 UTC

    My experience with host computers is very limited, but depending on the type of your host you might want to consider the Perl/VMS build and look whether they have VSAM support or not. Other than that, I would try to program a client to the host program that sucks out the data through the 3270 terminal emulation if you have that kind of access to the host.

    There are also some commercial products out there that (claim to) create code to read files from the COBOL PICT statements or copybooks. Many host programs also have the capability to generate lists as output (formerly intended to be printed), maybe you can rework those lists into something to be processed.

    On the other side, the question is why move away from the host at all ? If you manage to achieve a critical mass of COBOL programmers (I guess 10 persons), you can even set up a COBOL shop and do work for other people.

    Disclaimer: I don't find COBOL fun and haven't yet programmed a single line in it, but many host applications are old and do the work they were intended to - so never change a running system.

    Update:As mikeB does point out to me, if you are lucky, you are on OS/390, there is also a Perl build for it, and I'd guess that there is some documented way of getting at VSAM files in some fashion. Also, a google search for Perl 390 VSAM gives http://pvhp.best.vwh.net/os390/OS390-Stdio/OS390-Stdio-0.005.html among others as a result, which discusses the OS390::Stdio module that exports some functions that sound interesting : vsamdelrec,vsamlocate and vsamupdate.

    perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
VSAM, ISAM, DL1 (Re: How can I read Vsam files.)
by Corion (Patriarch) on Dec 28, 2001 at 18:05 UTC

    After a talk with my local mainframe guru, here is some more information about the concepts of ISAM and VSAM databases.

    ISAM databases are little more than flat (row oriented) files together with an index (file) that gives the start offsets of the differen rows in the data file. Reading and sorting is only possible in one order, the order determined by the index.

    VSAM databases have more than one index and also have the concept of "keys" for the data. You can traverse the data along several axes, as determined by the keys, so you don't have to scan the whole database on each query.

    Both databases have no intrinsic support for hierarchies or joined queries.

    The "successor" to VSAM and ISAM is DL1, a somewhat hierarchical storage of datasets which was famed for its raw speed. After that came DB2 and SQL as the mediator between the programmer and the database (and thus, the interest in different database concepts faded as all DBs are accessible via SQL).

    perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
Re: How can I read Vsam files.
by prgeorge (Initiate) on Dec 27, 2001 at 02:59 UTC
    I am trying to read , vsam files in windows and unix... parsing them will be a herculian task as they contain huge chunks of data ... an average of 10 million records.... I searched in google and all the search engines I know... never found one..... So if any body knows please help.
A reply falls below the community's threshold of quality. You may see it by logging in.