[librecat-dev] Moving MARC 600 to PICA 044A

Patrick Hochstenbach Patrick.Hochstenbach at UGent.be
Thu Feb 1 09:55:40 CET 2024


Hi,


Yes this is what the marc_copy does.


# Loop over each marc field
do marc_each()

  # If we have a 650…
    if marc_has('650')

    # Copy all the data of this particular 650 into some temporary field
          marc_copy('650','tmp')

          #  Keep the data as-is but change some of the tags/indicators/subfields
          set_field(tmp.0.tag,'044')
          set_field(tmp.0.ind1,'A')
    set_field(tmp.0.ind2,' ')
          add_field(tmp.0.subfields.$prepend.n,600)

    # Now paste this new tag back into the record
    marc_paste('tmp')

    remove_field('tmp')

  end

end

If you want to replace the 650 by 044, then you can do the same fix but using marc_cut instead of marc_copy.

Patrick

From: Siebert, Dr. Martina <Martina.Siebert at sbb.spk-berlin.de>
Date: Wednesday, 31 January 2024 at 19:52
To: Patrick Hochstenbach <Patrick.Hochstenbach at UGent.be>, librecat-dev at lists.uni-bielefeld.de <librecat-dev at lists.uni-bielefeld.de>
Subject: AW: Moving MARC 600 to PICA 044A
Hi Patrick,

Thanks for the example for a MARC to MARC loop when moving/copying subfields between MARC tags.

I am actually looking for a way to copy these subfields to PICA+. Sorry, I did not phrase this too well.
MARC

=600  10$aSen Sharma, Partha Sarthi,$d1970-$xTravel$zIndia$zAndaman and Nicobar Islands.

=600  10$aDescartes, René,$d1596-1650$xPolitical and social views.

Shall become PICA+

044A $N600$Sp$aPartha Sarthi$d1970-$xTravel$zIndia$zAndaman and Nicobar Islands

044A $N600$Sp$aDescartes, René$d1596-1650$xPolitical and social views

Luckily all subfields can keep their subfield “letter”, i.e. $a in MARC is $a in PICA+ in this case.

Best,
martina


Von: Patrick Hochstenbach <Patrick.Hochstenbach at UGent.be>
Gesendet: Mittwoch, 31. Januar 2024 19:28
An: Siebert, Dr. Martina <Martina.Siebert at sbb.spk-berlin.de>; librecat-dev at lists.uni-bielefeld.de
Betreff: Re: Moving MARC 600 to PICA 044A

Catmandu::MARC 1.32 supports capitals in MARC paths (so that your example should work).

Patrick
________________________________
From: Patrick Hochstenbach <Patrick.Hochstenbach at UGent.be<mailto:Patrick.Hochstenbach at UGent.be>>
Sent: 31 January 2024 19:17
To: Siebert, Dr. Martina <Martina.Siebert at sbb.spk-berlin.de<mailto:Martina.Siebert at sbb.spk-berlin.de>>; librecat-dev at lists.uni-bielefeld.de<mailto:librecat-dev at lists.uni-bielefeld.de> <librecat-dev at lists.uni-bielefeld.de<mailto:librecat-dev at lists.uni-bielefeld.de>>
Subject: Re: Moving MARC 600 to PICA 044A


Hi



This is the fix:

do marc_each()

  if marc_has('650')

    marc_copy('650','tmp')

    set_field(tmp.0.tag,'044')

    set_field(tmp.0.ind1,'A')

    set_field(tmp.0.ind2,' ')

    add_field(tmp.0.subfields.$prepend.n,600)

    marc_paste('tmp')

    remove_field('tmp')

  end

end

For some reason Catmandu::MARC doesn't like the $N​ (capital N) subfield. But, I can add a $n (lowercase n) subfield this way. I need to check why capitals are not supported.

Patrick
________________________________
From: librecat-dev-bounces at lists.uni-bielefeld.de<mailto:librecat-dev-bounces at lists.uni-bielefeld.de> <librecat-dev-bounces at lists.uni-bielefeld.de<mailto:librecat-dev-bounces at lists.uni-bielefeld.de>> on behalf of Siebert, Dr. Martina <Martina.Siebert at sbb.spk-berlin.de<mailto:Martina.Siebert at sbb.spk-berlin.de>>
Sent: 31 January 2024 16:53
To: librecat-dev at lists.uni-bielefeld.de<mailto:librecat-dev at lists.uni-bielefeld.de> <librecat-dev at lists.uni-bielefeld.de<mailto:librecat-dev at lists.uni-bielefeld.de>>
Subject: [librecat-dev] Moving MARC 600 to PICA 044A


Dear all,



I am trying to move MARC 600 (and 650 etc.) LOC subject headings to PICA+ 044A. 600er fields are repeatable as are most of their subfields.

Good thing: PICA+ 044A just reproduces the MARC 600er fields with all their subfields as they are, only prepending it with $N giving the original MARC tag and an indicator ($S) which is fix for each of the 6XX MARC fields. My problem is the copying of the set of repeatable subfields from MARC to PICA.



To put it simple:

   I have this

=600  10$aSen Sharma, Partha Sarthi,$d1970-$xTravel$zIndia$zAndaman and Nicobar Islands.

=600  10$aDescartes, René,$d1596-1650$xPolitical and social views.



   and I need this

044A $N600$Sp$aPartha Sarthi$d1970-$xTravel$zIndia$zAndaman and Nicobar Islands

044A $N600$Sp$aDescartes, René$d1596-1650$xPolitical and social views



The “Catmandu Cheatsheet” lists a “marc_copy”/”marc_paste” routine which does the trick for moving all subfields from one MARC tag to another MARC tag. But how to “copy” this from MARC and “paste” it to PICA? And how to put this within a marc_each() loop?



Best,

Martina



______________________________________________

Dr. Martina Siebert

Ostasienabteilung | CrossAsia

Staatsbibliothek zu Berlin – Preußischer Kulturbesitz



martina.siebert at sbb.spk-berlin.de<mailto:martina.siebert at sbb.spk-berlin.de>

www.staatsbibliothek-berlin.de<http://www.staatsbibliothek-berlin.de/>



Im Rahmen der E-Mail-Kommunikation werden gegebenenfalls personenbezogene Daten verarbeitet.
Unsere Hinweise zum Datenschutz finden Sie hier: http://sbb.berlin/datenschutz


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.uni-bielefeld.de/mailman2/unibi/public/librecat-dev/attachments/20240201/f6dd131f/attachment.html>


More information about the librecat-dev mailing list