[librecat-dev] sorting MARC fields

Patrick Hochstenbach Patrick.Hochstenbach at UGent.be
Thu Jul 13 11:13:34 CEST 2017

There is no sorting of MARC fields in the Fix language. One can add fields by `marc_add` fixes. The order of the new fields is in the order you execute the marc_add commands.

With the marc_paste (the nephews of marc_copy and marc_cut) you can decide where in the record the new marc record should be pasted:

  # Paste mycopy after the last 300 field
  marc_paste(mycopy, at:300)


In general there is no condition how MARC records could be sorted. Marc tags can be repeated:

   500 $aZorro, this is my First note
   500 $aAlso a nice not, but not the first
   500 $aWell this is the last note

Sorting the notes will result in errors in the catalogging. MARC is not a table or database format but markup language ..

Catmandu::MARC doesn’t yet have a retain (or marc_filter) option. But it would be a nice addition if there are use cases (could you add an issue for this on github).

The remove_field(fld_type) is not required if you only export your records back to MARC. The Catmandu::Exporter::MARC only needs the content of the ‘record’ field, the rest is ignored.

> On 13 Jul 2017, at 10:25, Uldis Bojars <captsolo at gmail.com> wrote:
> set_array(ok_fields, FMT, LDR,
>     008, 040, 041, 075, 100,
>     240, 245, 246, 260,
>     377, 380, 388, 400, 490,
>     600, 630, 650, 670, 677,
>     700, 720, 908, 910)
> do marc_each()
>     copy_field(record.0.0, fld_type)
>     unless in(fld_type, ok_fields)
>         remove_field(record)
>     end
>     remove_field(fld_type)                  # is this needed?
> end
> remove_field(ok_fields)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.uni-bielefeld.de/mailman2/unibi/public/librecat-dev/attachments/20170713/0545ff63/attachment.asc>

More information about the librecat-dev mailing list