[librecat-dev] marc_match does not like 8806?

Patrick Hochstenbach Patrick.Hochstenbach at UGent.be
Tue Mar 12 10:46:37 CET 2024


Hi

I’m sorry this is such a pain. This fix should do the trick:

do marc_each()
if marc_match(8806,'100')
  set_field(zzz,true)
end

if marc_match(1006,'880')
  set_field(yyy,true)
end
end

retain(_id,yyy,zzz)

which will result in:

% catmandu convert MARC to YAML --fix my.fix < author.mrc
---
_id: in00005597484
...
---
_id: in00005597483
yyy: 'true'
zzz: 'true'
...

It is safer when you need to reason over MARC fields that are repeated (such as the 880) field to use the `do marc_each() …. end` construct. This will process a MARC record line by line.

BR
Patrick

From: librecat-dev-bounces at lists.uni-bielefeld.de <librecat-dev-bounces at lists.uni-bielefeld.de> on behalf of Siebert, Dr. Martina <Martina.Siebert at sbb.spk-berlin.de>
Date: Monday, 11 March 2024 at 18:45
To: librecat-dev at lists.uni-bielefeld.de <librecat-dev at lists.uni-bielefeld.de>
Subject: [librecat-dev] marc_match does not like 8806?
Hello,

I am lost :(
I am now fighting my way through a mixed pile of single- and multi-script MARC-records.
This was meant as a simple check if there exists a non-Latn version of – for example - the author field (MARC 100) - here tested with “convert to YAML” to see if it is working at all:
if marc_match(8806,'100')
set_field(zzz,true)
end
But it doesn’t work.
But this does:
if marc_match(1006,'880')
set_field(yyy,true)
end
What am I missing?
I attach a 2 record sample (one with a non-linked 100, one with 100$6880). The second one should return both zzz:true, yyy:true but only returns yyy:true.

(just starting from the 100 field is not an option, because sometimes the $6880 is missing in the records I have, while the 880ies seem all to have $6 references)

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/20240312/f5b3a42f/attachment.html>


More information about the librecat-dev mailing list