Merge Text Data into MARC records

In general, to merge data from text to MARC with MARC Global, the following items are needed:

  1. A tab-delimited textfile consisting of two columns, where column 1 contains a match key, and column 2 contains the data to be merged.
  2. A MARC file containing a tag that the match key from the textfile will match.

Once these requirements are met, text data can be merged to MARC records using MARC Global.


MARC File notes

  • Make sure there is a match key (typically an 001, 035$a, etc.) in each record that is to be merged-to. If you have a choice, use a non-repeatable tag like the 001 (as this will improve performance).
  • There can be no delimiters in the match key (use the data entry form in MARC Global to specify a subfield–see below)
  • The match key must match the first column of the Textfile exactly 1)

Textfile notes

  • If the textfile is generated from some sort of database or spreadsheet, remove the header row.
  • If the textfile is generated from Excel, watch out for quoted column values–the quotes must be removed.
  • Use a dollarsign ('$') to represent the MARC Subfield delimiter; if the text data in column 2 contains a literal dollarsign–
 $c$20.00 

–it must be enclosed in square brackets–

 $c[$]20.00 

–or the program will think that it is a delimiter.

  • The text data in column 2 cannot include indicators (these may be specified on the 'Add Tag' form, if need be); it can begin with a subfield delimiter (or, if not, you can specify this on the 'Add Tag' form).
  • Exercise caution when using a text editor to manipulate textfile containing diacritics. Some text editors 2) will convert the UTF-8 characters to CP-1252, and this will make these characters invalid in MARC (regardless of the Leader/09 setting).
  • You will need write permission in the folder where the textfile is loaded from, as the program makes a copy of it there while generating the internal memory database.

General notes

  • Unlike the similar task in MARC Review, regular expressions cannot be used in column 1 of the textfile.
  • On the other hand, the Merge Text function in MARC Global matches keys using a different routine than MARC Review; therefore, a control number of '21' will only match a MARC field containing '21', and not one containing '210', '10021', etc.
  • If there are duplicate match keys in the text file, each corresponding column 2 value will be merged to the same MARC record. (So you can use this process to merge multiple 856's from text to MARC).
  • If there are duplicate match keys/records in the MARC file, the text merge will be repeated for each record3).


In addition to the above, if you plan on saving this review for future use/re-use, make sure that the textfile is located in a folder that is not likely to be changed or moved. The reason for this is that, in a saved review, MARC Global saves the name of the file (not the items themselves), and if the file were to be moved, the saved review would become invalid.


Processing outline

MARC Global will read each MARC record from the file normally. It will then search the record for the pattern containing the match key. If found, it will then search the list of match keys from the textfile for a match. If found, it will then add the second column from the matching textfile row to the Tag specified on the 'Add New Tag' form.

Step by step Example

In this example, we want to merge the text from column 2 in the textfile into a 856 tag in the matching MARC records. We will use an 001 tag to link the MARC records and the text data. In the example below, the first column contains an 001, and the second column contains the data that will become the 856 field.

ccn00217011    Contents$uhttp://www.resource.com/toc/ID24154657
ccn00217059    Contents$uhttp://www.resource.com/toc/ID24354683
...

Start MARC Report, select the MARC file that you want to merge the text data to, and start MARC Global.

On the PATTERN form, enter '001' into the TAG box, press TAB, then right-click on the DATA box. The following menu will display:

Select 'Merge list' from the menu, then navigate to the textfile containing the data to be merged and select it. The program will load the textfile into memory and, if all went well, produce a pop-up like the following:

Press OK, press NEXT, then on the 'Types of Global Change' form, select the 'Add a New Tag' option, and press NEXT.

On the 'Add Tag' form, enter '856' in the TAG box, '3' in the SUBF box (because the textfile data lacks an opening subfield), press TAB, then right-click on the DATA box. This message should pop-up:

Note: if column 2 in the textfile was formatted with a leading subfield

   ccn00217011    $3Contents$uhttp://www.resource.com/toc/ID24154657

you will need to clear the SUBF box on the Add New Tag form.

Click YES, then select the appropriate option form the 'Additional options' box below:

  • Skip–Do not process any matching records that already contain an 856
  • Add–856s from the textfile are added to matching records
  • Replace–856s from the textfile will replace 856s in matching records

Once the 'Add Tag' form is complete, press NEXT, setup the output options, then run the task; the results summary should look something like this;

Source file: D:\MARC\imports\sent2vendor.mrc
210 record(s) in source file.
210 record(s) matched the pre-processing pattern: 
  AND 001 [Data from List] [Case=Y] 
210 record(s) matched the Global Change options.
210 tag(s) had the Global Change applied: 
  Add Tag 856$a [Data from List] [Case=Y]  

Limitations

  • The limit on the number of rows in the text file has now been removed.
  • The maximum field length for the match key (column 1) of the text file is 128 bytes (This is supposed to be a key field, after all).
  • The maximum field length for column 2 of the text file is 9,999 bytes–this is a MARC21 limit.
1)
Deal with normalization issues either by using MARC Global to adjust the match key in the MARC records, or a text editor to adjust the first column of the textfile.
2)
our trusty Textpad, in fact, does exactly this
3)
Hint: the MARC file can be deduped by running the Sort utility
help/merge_text.txt · Last modified: 2021/12/29 16:21 (external edit)
Back to top
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki