Hi All,

I'm developing a script for an application that uses Zeta Perl for
Z39.50 connections.  I'm hoping those of you familiar with Zeta Perl can
help me with this.

When I specify the record syntax as MARC or SUTRS everything works fine.
But when I specify the record syntax as "OPAC," using the OID
1.2.840.10003.5.102, I get nothing.  Actually, I get a result set from
the Z39.50 target, but when I try to print the results, nothing is
outputted to the screen.

I know the target is capable of returning records in OPAC format --
which I take is some type of MARC XML? -- since I can successfully query
and display the results using other Z39.50 applications.

I have a feeling the problem lies more with my limited knowledge of Perl
rather than something specific with the Zeta module.

Here's my code:

================

use Zeta;

&lookup;

sub lookup {

        my $issn = "0098-7484";

        my $target = "pac.csusm.edu";
        my $port = 210;
        my $database = "Innopac";

        my $resultset = "zeta";
        my $query = "1=8 " . $issn;
        my $attrid = "BIB1";
        my $start = 1;
        my $format = "b";
        my $howmany = 1;
        my $syntax = "1.2.840.10003.5.102"; #OPAC

        my @holdings = ();
         
        #establish a connection with a Z39.50 Target over TCP/IP
        $zc = Zeta::Connection::New ($target, $port);
        
        if (! $zc) {
                $strError ="couldn't connect to target\n";
        } else {
        
                # initialize the association
                ($status, $reason, $result, $newrefid) = $zc->Init
($user, $password, $refid);
        
                if (! $status) {
                        $strError = "couldn't initialize the
association";           
                } elsif (! $result) {                   
                        $strError = "target rejected request\n";

                } else {
        
                        #try to create a result set
                        ($status, $reason, $found, $info)
                                = $zc->Search ($database, $resultset,
$query, $attrsetid);
                
                        if (! $status) {
                                $strError = "couldn't create result
set\n";                         
                        } elsif (! $found ) {
                        
                                #got no results so it's not here
                                $strError = "no results";
                        
                        } else {

                                # try to grab records from result set
                                ($status,  $reason,  $returned,
@records)
                                        = $zc->Present ($resultset,
$howmany,  $start,  $format,  $syntax); 
                                
                                if (! $status) {
                                        $strError = "couldn't process
result set\n";                  
                                } else {
                                                        
                                        #close the association
                                        ($status, $reason) = $zc->Close
($close);
                                        
                                        print "$returned\n";
                                                
                                        #cycle thru results, printing to
screen
                                                
                                        foreach $data (@records) {
                                        
                                                print $data;
                                        }

                                }
                        }
                }
        }
        print "$strError\n";
}1;

================

This prints to the screen:

1
1.2.840.10003.5.102&

============================
David Walker
Web Developer
Library
California State University, San Marcos
ph: (760) 750-4379
============================

Reply via email to