--- casopisi/marc2stream.pl 2002/10/26 21:22:43 1.2 +++ casopisi/marc2stream.pl 2002/10/27 21:20:10 1.3 @@ -5,8 +5,11 @@ use URI::Escape; require "../common.pm"; +$|++; +my $debug=0; + my $file = shift @ARGV; -my $index = shift @ARGV|| die "Usage: $0 [marc file] [index dir]"; +my $index = shift @ARGV || die "Usage: $0 [marc file] [index dir]"; my %id_stored; # to aviod duplicates @@ -14,10 +17,7 @@ my $nr = $x->openmarc( { file => $file, format => 'usmarc' }) || die "Can't open MARC file '$file'"; -print "file: '$file' 773 t: ",$x->getfirstvalue({record=>$x->nextmarc(1),field=>773,subfield=>'t',delimiter=>" "}),"\n"; -$x->nextmarc(-1); - -my $dir = open_data_files($index); +my $dir = open_data_files($index,$debug); my $last_tell=0; print MPS "M working...\n"; @@ -29,6 +29,8 @@ $rec = $x->marc_count(); # print $x->getfirstvalue({record=>$rec,field=>245,subfield=>'a',delimiter=>" "}),"<--\n"; + print "file: '$file' 773 t: ",$x->getfirstvalue({record=>$rec,field=>773,subfield=>'t',delimiter=>" "})," [index: $index]\n" if ($last_tell == 0); + my $bib = ""; my $mps = ""; @@ -80,8 +82,9 @@ print MPS $mps; $id_stored{$id}++; + print "_" if ($debug); } else { - print "."; + print "." if ($debug); } }