## Example U2 this is a modified script with thanks to the MARC::Record ## designers and documentation group use MARC::Batch; my $batch = MARC::Batch->new('USMARC','/home/mike1/lib4per/MICRO.new'); open(OUT,'>new1.dat') or die $!; $batch->strict_off(); ## read in each record. while ( my $record = $batch->next() ) { ##fetch 852h my $good = $record->field('852'); my $goodsub = $good->subfield('h'); ## find the tag after 900. my $before; foreach ($record->fields()) { $before = $_; last if $_->tag() > 900; } ## create the 942 field. my $new = MARC::Field->new('942','','',k=>$goodsub); ## insert our 942 field after the $before. $record->insert_fields_before($before,$new); ## and print out the new record. print OUT $record->as_usmarc(); }[snip]
michael reavey mrmrmr50@rediffmail.com