Hi, Aaron. I'm afraid this script is too complex and too
tied to your
own system for us to be able to quickly identify any problem
that
might be caused by our software. Please break this down
into the
simplest possible non-interactive program that clearly
demonstrates
the problem -- then we'll see if we can help.
Aaron Huber writes:
> We have developed a script to do searches on a tab
delineated text
> file to see if our library location owns certain
titles. This is
> accomplished by reading the entire text file into an
array, then
> doing a title search on each entry. If the title is
found we
> further check the MARC record to see if the author
matches what is
> in the text file. Then we check to see if our
location owns a copy
> of it by examining the 949 field. For some reason
when this script
> is run, we have been getting many errors. It also
seems to skip
> many hundreds of records in the array but there
doesn't seem to be
> any pattern to this action. Any help would be very
appreciated.
> We are self taught perl programmers.
>
> Thank You.
>
> #!/usr/bin/perl
>
> use ZOOM;
> use MARC::Record;
>
> print "Enter Start: ";
> my $count = <STDIN>;
> chomp $count;
>
> open (ADV, "ramblewoodES.txt");
> while ($term = <ADV>) {
> push terms, $term;
> }
> close ADV;
>
> zoom();
>
> sub zoom{
>
> $advtitle = terms[$count];
> my $errtitle = $advtitle;
> $advtitle =~ s/t.+tt.+n//;
> $advtitle =~ s/s$//;
>
> $advauth = terms[$count];
> my $errauth = $advauth;
> $advauth =~ s/ttt.+n//;
> $advauth =~ s/^.+t//;
> $advauth =~ s/,//g;
> $advauth =~ s/.//g;
> $advauth =~ s/s.+//g;
>
> $level = terms[$count];
> my $errlevel = $level;
> $level =~ s/n//;
> $level =~ s/^.+t.+tt//;
>
> $count++;
>
> eval {
> my $host = "www.browardlibrary.org";
> my $port = "210";
>
> my $conn = new ZOOM::Connection($host, $port,
databaseName => "bcl");
>
> $conn->option(preferredRecordSyntax =>
"usmarc");
>
> my $rs = $conn->search_pqf(' attr 1=4
"' . $advtitle . '"');
>
> my $n = $rs->size();
>
> if ($n == 0){
> print "nNo Records Found for
$advtitlen";
> open FH, (">>notfound.xls");
> print FH "$advtitlet$advauthn";
> close FH;
> zoom();
> }
>
> if ($n >= 100) {zoom();}
>
> print "n$count.) Found $n Records for
$advtitlen";
>
> my $i = 1;
>
> #main loop to get record info
>
> while ($i <= $n){
>
> $rec = $rs->record($i);
> if ($rec){
> $raw = $rec->raw();
>
> #read in raw MARC to record
> my $mrec = new_from_usmarc MARC::Record($raw);
>
>
> #retrive the 949 field to determine location and
shelf status
> my shelf = $mrec->field('949');
>
> foreach my $status ( shelf) {
> push shelf_status, $status->as_string();
> }
>
> #get the author
> my $author =
$mrec->subfield('100',"a");
> $origauth = $author;
> $author =~ s/,//g;
> $author =~ s/.//g;
> $author =~ s/s.+//g;
>
> print "t-n";
>
> foreach my $location ( shelf_status){
> if ($location =~ m/sNORs/ && $author eq
$advauth){
>
> #get the title
> my $title =
$mrec->subfield('245',"a");
> my $subtitle =
$mrec->subfield('245',"b");
>
> #concat the title and subtitle
> $title = $title . " " . $subtitle;
>
> #get the control number
> my $control =
$mrec->subfield('910',"a");
> $control =~ s/CARL0//;
>
> #get call number info
> my dewey =
$mrec->field('099');
> foreach my $ddc ( dewey) {
> push callnum,
$ddc->as_string();
> }
>
> #output to user
> print "t$i.t$titlet callnumn";
>
> #write to file
> open FH, (">>RamblewoodES.xls");
> print FH "$titlet$origautht callnumt$controlt$leveln";
> close FH;
>
> #empty out arrays
> dewey = ();
> callnum = ();
> }
> }
>
> shelf = ();
> shelf_status = ();
> $i++;
> }
> else {zoom();}
> }
> };
>
> if ($ ) {
> print "nt****Server Failure****an";
> open FH, (">>errlog.xls");
> print FH
"$errtitlet$errauthtt$errleveln";
> close FH;
> zoom();
> }
> }
>
>
> Aaron S. Huber
> Librarian I - Audiovisual/Popular Library
> Northwest Regional Library
> 3151 University Drive
> Coral Springs, FL 33065.
> 954-341-3965 ext 233
> Broward County Library Division
> A Service of the Broward County Board of
Commissioners
> ahuber browardlibrary.org
>
>
>
************************************************************
**********
> Please note: Except for state and federal exemptions,
Florida has a very broad public records law. Most written
communications to or from County employees regarding County
business are public records and available to the public and
media upon request. Your e-mail communications may be
subject to public disclosure.
>
> This email and any files transmitted with it are
intended solely for the use of the individual or entity to
whom they are addressed. If you have received this email in
error please notify the sender.
>
> This footnote also confirms that this email message
has been swept for the presence of computer viruses.
>
************************************************************
**********
>
> <HTML><HEAD>
> <META http-equiv=Content-Type
content="text/html; charset=iso-8859-1">
> <META content="MSHTML 6.00.2900.3020"
name=GENERATOR></HEAD>
> <BODY style="MARGIN: 4px 4px 1px; FONT: 10pt
Tahoma">
> <DIV>We have developed a script to do searches
on a tab delineated text file to see if our library location
owns certain titles. This is accomplished by
reading the entire text file into an array, then doing a
title search on each entry. If the title is found
we further check the MARC record to see if the author
matches what is in the text file. Then we check to
see if our location owns a copy of it by examining the 949
field. For some reason when this script is run, we
have been getting many errors. It also seems to
skip many hundreds of records in the array but there doesn't
seem to be any pattern to this action. Any help
would be very appreciated. We are self taught perl
programmers. </DIV>
> <DIV> </DIV>
> <DIV>Thank You.<BR></DIV>
> <DIV>#!/usr/bin/perl </DIV>
> <DIV> </DIV>
> <DIV>use ZOOM;<BR>use
MARC::Record;</DIV>
> <DIV> </DIV>
> <DIV>print "Enter Start:
";<BR>my $count =
<STDIN>;<BR>chomp $count;</DIV>
> <DIV> </DIV>
> <DIV>open (ADV,
"ramblewoodES.txt");<BR>while ($term =
<ADV>) {<BR> push terms,
$term;<BR>}<BR>close ADV;</DIV>
> <DIV> </DIV>
> <DIV>zoom();</DIV>
> <DIV> </DIV>
> <DIV>sub zoom{</DIV>
> <DIV> </DIV>
> <DIV> $advtitle = terms[$count]; <BR> my
$errtitle = $advtitle;<BR> $advtitle =~
s/t.+tt.+n//;<BR> $advtitle =~
s/s$//;</DIV>
> <DIV> </DIV>
> <DIV> $advauth = terms[$count];<BR> my $errauth =
$advauth;<BR> $advauth =~
s/ttt.+n//;<BR> $advauth =~
s/^.+t//;<BR> $advauth =~
s/,//g;<BR> $advauth =~
s/.//g;<BR> $advauth =~
s/s.+//g;</DIV>
> <DIV> </DIV>
> <DIV> $level = terms[$count];<BR> my $errlevel =
$level;<BR> $level =~
s/n//;<BR> $level =~
s/^.+t.+tt//;</DIV>
> <DIV> </DIV>
> <DIV> $count++;</DIV>
> <DIV> </DIV>
> <DIV> eval
{<BR> my $host = "<A
href="ht
tp://www.browardlibrary.org">www.browardlibrary.org&
lt;/A>";<BR> my $port =
"210";</DIV>
> <DIV> </DIV>
> <DIV> my $conn = new
ZOOM::Connection($host, $port, databaseName =>
"bcl");</DIV>
> <DIV> </DIV>
>
<DIV> $conn->option(preferre
dRecordSyntax => "usmarc");</DIV>
> <DIV> </DIV>
> <DIV> my $rs =
$conn->search_pqf(<A href="mailto:' attr">' attr</A> 1=4 "' . $advtitle .
'"');</DIV>
> <DIV> </DIV>
> <DIV> my $n =
$rs->size();</DIV>
> <DIV> </DIV>
> <DIV> if ($n ==
0){<BR> print "nNo
Records Found for
$advtitlen";<BR> op
en FH,
(">>notfound.xls");<BR>&nb
sp; print FH
"$advtitlet$advauthn";<BR> &n
bsp; close
FH;<BR> zoom();<BR>
}</DIV>
> <DIV> </DIV>
> <DIV> if ($n >= 100)
{zoom();}</DIV>
> <DIV> </DIV>
> <DIV> print "n$count.)
Found $n Records for $advtitlen";</DIV>
> <DIV> </DIV>
> <DIV> my $i = 1;</DIV>
> <DIV> </DIV>
> <DIV>#main loop to get record
info &n
bsp; &n
bsp; &n
bsp; &n
bsp; &n
bsp; <BR> <BR>while ($i
<= $n){</DIV>
> <DIV> </DIV>
> <DIV> $rec =
$rs->record($i);<BR> if
($rec){<BR> $raw =
$rec->raw();</DIV>
> <DIV> </DIV>
>
<DIV>  
; #read in raw MARC to
record<BR> my $mrec = new_from_usmarc
MARC::Record($raw);</DIV>
> <DIV> </DIV>
> <DIV><BR> #retrive the 949 field
to determine location and shelf status<BR> my
shelf =
$mrec->field('949');<BR> <BR>&am
p;nbsp;foreach my $status ( shelf)
{<BR>  
; push shelf_status,
$status->as_string();<BR> }&
lt;BR> <BR> #get the
author<BR> my $author =
$mrec->subfield('100',"a");<BR>&n
bsp;$origauth = $author;<BR> $author =~
s/,//g;<BR> $author =~
s/.//g;<BR> $author =~
s/s.+//g;</DIV>
> <DIV> </DIV>
> <DIV> print
"t-n";</DIV>
> <DIV> </DIV>
> <DIV> foreach my $location
( shelf_status){<BR> if
($location =~ m/sNORs/ && $author eq
$advauth){</DIV>
> <DIV> </DIV>
> <DIV> #get the
title<BR> my $title =
$mrec->subfield('245',"a");<BR>&n
bsp; my $subtitle =
$mrec->subfield('245',"b");<BR>&n
bsp;<BR> #concat the
title and
subtitle<BR> $title =
$title . " " .
$subtitle; <BR>
<BR> #get the
control number<BR> my
$control =
$mrec->subfield('910',"a");<BR>&n
bsp; &n
bsp; $control =~
s/CARL0//;</DIV>
> <DIV> </DIV>
>
<DIV>  
;  
; #get
call number
info<BR> &n
bsp;
my dewey =
$mrec->field('099');<BR> &am
p;nbsp; &am
p;nbsp; foreach my
$ddc ( dewey)
{<BR>  
;  
;  
;  
; push callnum,
$ddc->as_string();<BR> &
nbsp; &
nbsp; &
nbsp;
}<BR>  
;
<BR> #output to
user <BR> &n
bsp;print "t$i.t$titlet callnumn"; </DIV>
> <DIV> </DIV>
> <DIV> #write to
file<BR> open FH,
(">>RamblewoodES.xls");<BR>&am
p;nbsp; print FH
"$titlet$origautht callnumt$controlt$leveln";<BR> 
; close
FH;<BR> <BR> &nb
sp; #empty out
arrays<BR> dewey =
(); <BR> callnum =
();<BR> }<BR>&n
bsp; &n
bsp;
} <BR> <BR>
; shelf = ();<BR> shelf_status =
();<BR> $i++;<BR> }<BR>&
amp;nbsp;else
{zoom();}<BR> }<BR>};</DIV>
> <DIV> </DIV>
> <DIV> if ($ )
{<BR> print "nt****Server
Failure****an";<BR> open FH,
(">>errlog.xls");<BR> 
; print FH
"$errtitlet$errauthtt$errleveln";<BR>&am
p;nbsp; close
FH;<BR> zoom();<BR>
}<BR>}<BR></DIV>
> <DIV> </DIV>
> <DIV>Aaron S. Huber<BR>Librarian I -
Audiovisual/Popular Library<BR>Northwest Regional
Library<BR>3151 University Drive<BR>Coral
Springs, FL 33065.<BR>954-341-3965 ext
233<BR>Broward County Library Division<BR>A
Service of the Broward County Board of
Commissioners<BR><A href="mailto:ahuber browardlibrary.org">ahuber browardlibrary.org</A></DIV>
> <P STYLE="margin-top: 0pt;margin-bottom:
0pt;"><SPAN
STYLE="FONT-FAMILY:'Arial';FONT-SIZE:8pt;">****
************************************************************
****** </SPAN></P>
> <P STYLE="margin-top: 0pt;margin-bottom:
0pt;"><SPAN
STYLE="FONT-FAMILY:'Arial';FONT-SIZE:8pt;">Plea
se note: Except for state and federal exemptions, Florida
has a very broad public records law. Most written
communications to or from County employees regarding County
business are public records and available to the public and
media upon request. Your e-mail communications may be
subject to public disclosure. </SPAN><SPAN
STYLE="FONT-SIZE:12pt;"><BR>
> </SPAN>
> </P>
> <P STYLE="margin-top: 0pt;margin-bottom:
0pt;"><SPAN
STYLE="FONT-FAMILY:'Arial';FONT-SIZE:8pt;">This
email and any files transmitted with it are intended solely
for the use of the individual or entity to whom they are
addressed. If you have received this email in error please
notify the sender. </SPAN>
> </P>
> <P STYLE="margin-top: 0pt;margin-bottom:
0pt;"><SPAN
STYLE="FONT-FAMILY:'Arial';FONT-SIZE:8pt;">
</SPAN>
> </P>
> <P STYLE="margin-top: 0pt;margin-bottom:
0pt;"><SPAN
STYLE="FONT-FAMILY:'Arial';FONT-SIZE:8pt;">This
footnote also confirms that this email message has been
swept for the presence of computer viruses. </SPAN>
> </P>
> <P STYLE="margin-top: 0pt;margin-bottom:
0pt;"><SPAN
STYLE="FONT-FAMILY:'Arial';FONT-SIZE:8pt;">****
************************************************************
****** </SPAN> </P></BODY></HTML>
> _______________________________________________
> Net-z3950 mailing list
> Net-z3950 lists.indexdata.dk
> http://lists.indexdata.dk/cgi-bin/mailman/listinfo/n
et-z3950
_______________________________________________
Net-z3950 mailing list
Net-z3950 lists.indexdata.dk
http://lists.indexdata.dk/cgi-bin/mailman/listinfo/n
et-z3950
|