Using the 'Copy Subfield' task in MARC Global

We've made a few changes to how 'Copy Subfield' works in the current version.

First, when selecting the 'Move subfield' option in 232, the program would move the whole field instead of just the specified subfield. This problem is fixed in 233.

In addition to this fix, we've enhanced the capability of 'Copy Subfield' in 233, adding three new possibilities to the standard use of this task.

Copying only a portion of a subfield

First, its now possible to select a substring within a subfield for copying. There are two ways to do this:

  1. By specifying the offset and length within the subfield of the substring to be copied
  2. By specifying a pattern to match the beginning of the substring to be copied

To use this technique, proceed as follows: Enter the Tag and Subfield to Copy From on the 'Copy Subfield' form, then right-click on the 'Subf' box. The following form will pop-up:

If you are working with fairly fixed data, you can use the 'Start At' field to enter the position–within the subfield–to begin copying from, and then use the 'Length' field to enter the number of bytes to copy. Leave 'Length' set to 0 to copy all remaining bytes in the subfield. The example above will copy only the first four bytes from wahtever subfield is specified.

On the other hand, a pattern can also be entered in the 'Start At' field. The case-sensitive and regular expression options available in standard patterns are also supported here. The 'Length' field works as above; leave it to '0' to copy all remaining bytes, or set it to a number to copy only that many bytes from the point where the pattern matches.

We recently found this new option useful to copy all of the document IDs from a URL field into a separate tag (which was then used to match/merge/update records). For example, the source data looked like this;

856 40 $uhttp:web.lib.com/eBooks?docId=CX3477199999$zClick here to access. By using the 'Copy Subfield' + Pattern option– –we were able to generate a control number in each record that contained only the 'docID' portion of the 856 $u: 035 $aCX3477199999 Copying one subfield to many tags Second, its now possible in 233 to copy a specified subfield to all occurrences of a target tag. For example, to copy the first 049$a in a record to a $z in all occurences of a 949 field, we would use the following 'Copy Subfield' options: Thus, if the source record contains 049 $aMyCode 949 $aData$bMoreData 949 $aData$bMoreData 949 $aData$bMoreData the result of performing the above Copy Subfield task on this record would be 049 $aMyCode 949 $aData$bMoreData$zMyCode 949 $aData$bMoreData$zMyCode 949 $aData$bMoreData$zMyCode Copying many subfields to one tag Third, it is also possible in 233 to copy each occurrences of a subfield in a tag that repeats, to a new subfield in a single target tag. For example, to copy each $a subfield in a 949 tag to a new $z in a 999 tag, we would use the following options: Thus, if the source record contains 949 $aData1 949 $aData2 949 $aData3 the result of performing the above Copy Subfield task on this record would be 949 $aData1 949 $aData2 949 $aData3 999 $zData1$zData2$zData3 For this to work, its important that the overlay option be set to 'Add new subf'; if it is set to 'Replace subfield' then each $z added to the 999 will overwrite the previous one, and the above result would look like: 949 $aData1 949 $aData2 949 $aData3 999 $zData3 One limitation to this second type of 'Copy Subfield' is that it will not work as expected if the subfields to be copied are repeated within a field. For example, if the source record contains 949 $aData1$aData2$aData3 the result of performing the same Copy Subfield task on this record would be 949 $aData1$aData2$aData3 999 $aData1 The program will only pick up the first $a in the source tag (even if you select the 'All' occurrence option). The desired result here is probably 949 $aData1$aData2$aData3 999 $aData1$aData2$aData3 Hopefully we can improve this behavior in a future version.

233/mg_copy_subfield.txt · Last modified: 2021/12/29 16:21 (external edit)
Back to top
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki