Bryan, man, that worked like a champ. Thank you so much for suggesting it. I 
like its clean-ness and efficiency.

If someone else is following this in the archives, here's the final version of 
my code:
   #Producer information and address.
   #Another field 270 could also be used for Distributor info.
   if ($record{"PROD"}) { #If there's a producer's name...
      my $pr = MARC::Field->new('260', ' ', ' ',
                             b=>$record{"PROD"},
                            );
      $marcrecord->insert_fields_ordered($pr);
   } #if there's a producer's name

   #All the rest of the producer's information...
   if ($record{"CONP"} ||
       $record{"ADP"}  ||
       $record{"CTYP"} ||
       $record{"STP"}  ||
       $record{"ZIPP"} ||
       $record{"CNP"}  ||
       $record{"PHP"}  ||
       $record{"FAXP"} ||
       $record{"PRODUCER_EMAIL"}
      ) {
      my @sf; #subfields container for data
      push @sf, 'a', $record{"ADP"}             if $record{"ADP"};
      push @sf, 'b', $record{"CTYP"}            if $record{"CTYP"};
      push @sf, 'c', $record{"STP"}             if $record{"STP"};
      push @sf, 'd', $record{"CNP"}             if $record{"CNP"};
      push @sf, 'e', $record{"ZIPP"}            if $record{"ZIPP"};
      push @sf, 'k', $record{"PHP"}             if $record{"PHP"};
      push @sf, 'l', $record{"FAXP"}            if $record{"FAXP"};
      push @sf, 'p', $record{"CONP"}            if $record{"CONP"};
      push @sf, 'm', $record{"PRODUCER_EMAIL"}  if $record{"PRODUCER_EMAIL"};

      my $marc270 = MARC::Field->new('270', '1', ' ', @sf);
      $marcrecord->insert_fields_ordered($marc270);

   } #If there's any producer information


Thanks, again, Bryan.

-Kevin

>>> Bryan Baldus <[EMAIL PROTECTED]> 08/03/05 03:00PM >>>
On Wednesday, August 03, 2005 12:31 PM, KEVIN ZEMBOWER wrote:
>I'd like to create a 270 field (I think) from this information. I'd like to
do something similar to this pseudo-code:
>my $mprod = MARC::Field->new('270', ' ', ' ',); #Base record
>$mprod = MARC::Field->update($mprod, a=>$ADP) if $ADP;
>$mprod = MARC::Field->update($mprod, b=>$CTYP) if $CTYP;
>$mprod = MARC::Field->update($mprod, c=>$STP) if $STP;
>....

Unless I'm mistaken, you should be able to do something similar to the above
(using the suggestions already provided by others) by building an array of
subfield code+data pairs:

push @subfields, 'a', $ADP if $ADP;
#... for each subfield element

Then, once all subfields have been added to @subfields:

$field = MARC::Field->new('270','','', @subfields);
$record->append_fields($field)

####
Please correct me if I am wrong,
Bryan Baldus
[EMAIL PROTECTED] 
[EMAIL PROTECTED] 
http://home.inwave.com/eija 
  

Reply via email to