#!/usr/bin/perl -w

use strict;
use MARC;

my $file = shift @ARGV || die "Usage: $0 [marc file]";

my $x = new MARC;
my $nr = $x->openmarc( { file => $file, format => 'usmarc' });

# read MARC file in memory
$x->nextmarc(-1);

my $max_rec = $x->marc_count();

print "file '$file' with '",$x->marc_count(),"' records...\n";

for(my $i=1; $i<=$max_rec; $i++) {
	print "REC #$i: ",$x->getfirstvalue({record=>$i,field=>245,subfield=>'a',delimiter=>" "}),"\n";
	print $x->output({format=>'ascii', record=>$i});
}

