Ed et al, Thanks for responding so quickly. > On Thu, Sep 25, 2003 at 07:54:29AM -0400, Joshua Ferraro wrote: > > Does anyone know how to add separators/terminators when building a single > > MARC record? > > Joshua, MARC::Record does this for you. Where is the code you used to generate > these records? Is it the Koha code? yes and no. My Z3950 Script calls the Koha subroutine MARCgetbiblio, puts the resulting string into a variable and then sends that string back to the user via a hash ref managed by SimpleServer:
my $MARCRecord = &MARCgetbiblio($dbh,$bibid); my $recordstring=$MARCRecord->as_usmarc(); #print "here is my record: $recordstring\n"; # Return the record string to the client $args->{RECORD} = $recordstring; So the problem may be either the way I am using MARCgetbiblio or MARCgetbiblio itself...I'm not really sure which. The MARCgetbiblio subroutine looks like this: sub MARCgetbiblio { # Returns MARC::Record of the biblio passed in parameter. my ($dbh,$bibid)[EMAIL PROTECTED]; my $record = MARC::Record->new(); #---- TODO : the leader is missing $record->leader(' '); my $sth=$dbh->prepare("select bibid,subfieldid,tag,tagorder,tag_indicator,su bfieldcode,subfieldorder,subfieldvalue,valuebloblink from marc_subfield_table where bibid=? order by tag,tagorder,subfieldcod e "); my $sth2=$dbh->prepare("select subfieldvalue from marc_blob_subfield whe re blobidlink=?"); $sth->execute($bibid); my $prevtagorder=1; my $prevtag='XXX'; my $previndicator; my $field; # for >=10 tags my $prevvalue; # for <10 tags while (my $row=$sth->fetchrow_hashref) { if ($row->{'valuebloblink'}) { #---- search blob if there is one $sth2->execute($row->{'valuebloblink'}); my $row2=$sth2->fetchrow_hashref; $sth2->finish; $row->{'subfieldvalue'}=$row2->{'subfieldvalue'}; } if ($row->{tagorder} ne $prevtagorder || $row->{tag} ne $prevtag ) { $previndicator.=" "; if ($prevtag <10) { $record->add_fields((sprintf "%03s",$prevtag),$prevvalue ) unless $prevtag eq "XXX"; # ignore the 1st loop } else { $record->add_fields($field) unless $prevtag eq " XXX"; } undef $field; $prevtagorder=$row->{tagorder}; $prevtag = $row->{tag}; $previndicator=$row->{tag_indicator}; if ($row->{tag}<10) { $prevvalue = $row->{subfieldvalue}; } else { $field = MARC::Field->new((sprintf "%03s",$prevt ag), substr($row->{tag_indicator}.' ',0,1), substr($row->{tag_indicator}.' ',1 ,1), $row->{'subfieldcode'}, $row->{'subfieldvalue'} ); } } else { if ($row->{tag} <10) { $record->add_fields((sprintf "%03s",$row->{tag}) , $row->{'subfieldvalue'}); } else { $field->add_subfields($row->{'subfieldcode'}, $r ow->{'subfieldvalue'} ); } $prevtag= $row->{tag}; $previndicator=$row->{tag_indicator}; } } # the last has not been included inside the loop... do it now ! if ($prevtag <10) { $record->add_fields($prevtag,$prevvalue); } else { # my $field = MARC::Field->new( $prevtag, "", "", %subfieldlist); $record->add_fields($field); } return $record; }