MARC::Record record length and leader bug?
[email protected] (Bryan Baldus)
| Newsgroups | perl.perl4lib |
|---|---|
| Message-ID | <1F95E99A11EFA541B0BDE754166A8F70018CD226@qbiex.qbi.quality-books.com> |
A recent posting on the OCLC-CAT discussion list ("Help needed de-duping,
editing and exporting a raw MARC file with Connexion") mentions difficulty
the poster is experiencing with using records with too many 949 fields for
MarcEdit to load. This led me to attempt to create a test MARC file to see
if I could replicate the problem. In the process, I believe I may have found
a problem with the way MARC::Record updates the leader for the record
length. Starting with a file containing a minimal raw MARC record (leader,
001 of '1', 008, and 245 of '.'), I ran the file through the loop:
while (my $record = $batch->next()) {
for my $fieldno (0..4810) { #where 4810 was the approximate number
of fields needed to push the record length past 99999
my $new_field = MARC::Field->new('949', '', '', a =>
"$fieldno");
$record->append_fields($new_field);
} #for fields
print OUT $record->as_usmarc(); #where OUT is an export file previously
opened
} # while
################################
The output file shows the start of the leader as "100032pam 22577931."
MARC::Record::set_leader_lengths has a line "substr($self->{_leader},0,5) =
sprintf("%05d",$reclen);". Is this supposed to limit the $reclen to 5
characters, or does sprintf "%05d" simply append the necessary 0s to make
sure the length is at least 5 digits? Since a record length over 99999 is
impossible, it might be good to have MARC::Record complain about exceeding
the record size limit if the $reclen > 99999, and to not exceed 5 characters
when setting the record length.
Please correct me if I am wrong. Thank you for your assistance,
Bryan Baldus
[email protected]
[email protected]
http://home.inwave.com/eija