Re: Getting started with Z39.50

[email protected] (Dennis Boone) Thu, 06 Apr 2017 17:00:32 -0400
Newsgroups perl.perl4lib
Message-ID <[email protected]>
 > Hello all....I haven't posted here for a long time, but have been
 > doing lots of interesting stuff with MARC/Perl....  I would like to
 > know an easy way to get started with Z39.50. (For example, how to get
 > MARC records from the LC, NLM, etc. servers) Anyone have some program
 > segments they would be willing to share?

Here's an extremely abbreviated code snippet that might help.  You'll
need to gather appropriate values to fill in, add some error checking,
etc.

    use MARC::Record;
    use MARC::Charset qw(marc8_to_utf8);
    use ZOOM;

    $zconn = new ZOOM::Connection($zhost, $zport, databaseName => $zdbnm);
    $zconn->option(preferredRecordSyntax => "usmarc");
    $zrs = $zconn -> search_pqf("\@attr 1=1007 $ean");
    $nr = $zrs -> size();
    $marc = new_from_usmarc MARC::Record($zrs -> record($i) -> raw());

De