## 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

ProblemsOrLimitations

 
herea.txt · Last modified: 2006/04/04 09:23 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki