/[webpac-proto]/casopisi/marc2stream.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /casopisi/marc2stream.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by dpavlin, Sat Oct 26 21:22:43 2002 UTC revision 1.3 by dpavlin, Sun Oct 27 21:20:10 2002 UTC
# Line 5  use MARC; Line 5  use MARC;
5  use URI::Escape;  use URI::Escape;
6  require "../common.pm";  require "../common.pm";
7    
8    $|++;
9    my $debug=0;
10    
11  my $file = shift @ARGV;  my $file = shift @ARGV;
12  my $index = shift @ARGV|| die "Usage: $0 [marc file] [index dir]";  my $index = shift @ARGV || die "Usage: $0 [marc file] [index dir]";
13    
14  my %id_stored;  # to aviod duplicates  my %id_stored;  # to aviod duplicates
15    
# Line 14  my $x = new MARC; Line 17  my $x = new MARC;
17  my $nr = $x->openmarc( { file => $file, format => 'usmarc' }) ||  my $nr = $x->openmarc( { file => $file, format => 'usmarc' }) ||
18          die "Can't open MARC file '$file'";          die "Can't open MARC file '$file'";
19    
20  print "file: '$file' 773 t: ",$x->getfirstvalue({record=>$x->nextmarc(1),field=>773,subfield=>'t',delimiter=>" "}),"\n";  my $dir = open_data_files($index,$debug);
 $x->nextmarc(-1);  
   
 my $dir = open_data_files($index);  
21  my $last_tell=0;  my $last_tell=0;
22    
23  print MPS "M working...\n";  print MPS "M working...\n";
# Line 29  while ($x->nextmarc(1)) { Line 29  while ($x->nextmarc(1)) {
29    
30          $rec = $x->marc_count();          $rec = $x->marc_count();
31  #       print $x->getfirstvalue({record=>$rec,field=>245,subfield=>'a',delimiter=>" "}),"<--\n";  #       print $x->getfirstvalue({record=>$rec,field=>245,subfield=>'a',delimiter=>" "}),"<--\n";
32            print "file: '$file' 773 t: ",$x->getfirstvalue({record=>$rec,field=>773,subfield=>'t',delimiter=>" "})," [index: $index]\n" if ($last_tell == 0);
33    
34          my $bib = "";          my $bib = "";
35          my $mps = "";          my $mps = "";
36    
# Line 80  while ($x->nextmarc(1)) { Line 82  while ($x->nextmarc(1)) {
82                  print MPS $mps;                  print MPS $mps;
83    
84                  $id_stored{$id}++;                  $id_stored{$id}++;
85                    print "_" if ($debug);
86          } else {          } else {
87                  print ".";                  print "." if ($debug);
88          }          }
89  }  }
90    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.26