Hi all,
After having my initial newbie question resolved, I've made tremendous progress on analyzing marc records from the archivists' toolkit, but now I'm trying to write the records out to two files – separating the "good" records from the "bad".
One of the steps is to change the indicator of a 520 field from blank to 3 if it matches the abstract that I'm pulling from the equivalent EAD XML. so I thought this would work:
for field520 in record.get_fields('520'):
# if the content of subfield 'a' matches the EAD abstract...
field520.indicators[0] = '3' # line 161 in attached python script
and if I then say "print field520.indicators", I do get ['3', ' '] to print to screen. However, when I check my marc file output by opening up the file in MarcEdit, the 520 indicators have not changed - they are still \\ instead of 3\. It seems like I'm only modifying a local instance of that particular field, and not the actual record, so when I write that record out to the file, the record is actually not changed (...maybe?) so I thought maybe it needs to be something like:
record['520'].indicators[0] = '3'
but then I want to only do this for this particular 520 field, not all 520 fields. I've tried to find a basic example of changing field indicators so that they change in the record, but if it's somewhere in the pymarc documentation, I've not found it.
Can anyone shed some light on what I'm doing wrong?
thanks in advance,
heidi
ps: if it helps, I've attached my full python script and my sample file of 1423 marc records that I'm working with.
pss: just an fyi, if you run the full script, it outputs the following 6 files:
00-BHSmarcRecs_bad.mrc
00-BHSmarcRecs_good.mrc
EAD520data.txt
lgAbstractsFile.txt
no7XXs.txt
noAbstractsFile.txt