Subject: | MARC::File::USMARC assumes that fields apper in directory order |
MARC::File::USMARC->decode() assumes that field data in the body of the record appears in the same order as the directory entries. That's not required by the standard, and you will run across records for which the assumption fails. The consequence of this is that tags get the wrong data.
The standard allows dead space/garbage between fields, too, so the technique of splitting on the end of field character is never guaranteed to produce the correct results.
Thanks to Tim Wentz for pointing out this problem.
A dump of the the first record in the attached example file:
Record: 1
Leader: 00748cam 2200277 4500
Tag Len Offset
=== ==== ======
001 11 0
005 17 11
008 39 28
010 13 67
020 15 80
040 19 95
043 12 114
050 16 126
082 14 142
092 17 156
035 16 173
035 15 189
035 15 389 *** OFFSET IS OUT OF SEQUENCE ***
100 16 204
245 40 220
260 41 260
300 32 301
490 28 333
651 13 361
852 66 404 *** OFFSET IS OUT OF SEQUENCE ***
995 15 374
Offset Tag data
====== ==================================
0 0000000001^
11 20000427061119.0^
28 690528s1969 nyuab 000 0 eng^
67 _a68008765^
80 _a080691100X^
95 _aDLC_cDLC_dm.c.^
114 _aNcho---^
126 _aF1504_b.W43^
142 _a972.83/05^
156 _a917.283_bWed^
173 _a 00000619^
189 _a0000000013^
204 _aWeddle, Ken^
220 _aHonduras in pictures /_cKen Weddle.^
260 _aNew York,_bSterling Pub. Co._c{1969}^
301 _a64 p._billus., map._c27 cm.^
333 _aVisual geography series^
361 _aHonduras^
374 _a60_a87_a90^
389 _a0000000013^
404 _a87_h917.283_p00099786_t1_b _iWed^
470 END OF RECORD^
00748cam 2200277 4500001001100000005001700011008003900028010001300067020001500080040001900095043001200114050001600126082001400142092001700156035001600173035001500189035001500389100001600204245004000220260004100260300003200301490002800333651001300361852006600404995001500374000000000120000427061119.0690528s1969 nyuab 000 0 eng a68008765 a080691100X aDLCcDLCdm.c. aNcho--- aF1504b.W43 a972.83/05 a917.283bWed a 00000619 a0000000013 aWeddle, Ken aHonduras in pictures /cKen Weddle. aNew York,bSterling Pub. Co.c{1969} a64 p.billus., map.c27 cm. aVisual geography series aHonduras a60a87a90 a0000000013 a87h917.283p00099786t1b iWed01060cam 2200277 4500001001100000005001700011008003900028010001700067040002900084050001700113082001000130092001500140035001600155035001500171035001500703100003100186245009800217260003600315300003100351490001800382520023500400650001200635650003300647852006400718995002300680000000000220000427061119.0690506s1968 nyua j 00010 eng a68010046 /AC aDLCcDLCdOCLdm.c.dIVS aPZ10.H78bIn a595.7 a595.7bHor a 00000788 a0000000025 aHornblow, Leonora,d 1920- aInsects do the strangest things /cby Leonora and Arthur Hornblow ; ill. by Michael K. Frith. aNew York,bRandom Housec{1968} a60 p.bcol. illus.c21 cm. aStep-up books aDescribes nineteen insects that have peculiar and strange characteristics like the camouflage of the walking stick, the driver ants that prefer people to picnics, and the bugs that row themselves like boats on the water's surface. aInsects aInsectsxHabits and behavior a92a72a87a75a74 a0000000025 a87h595.7p00098996t1b iHor00889cam 2200265 4500001001100000005001700011008003900028010001700067040001300084050001800097082001000115092001100125035001600136035001500152035001500548100001600167245005700183260005800240300002100298520018000319650002000499650002200519852006000563995000700541000000000320000427061119.0690428s1969 nyu j 000 1 eng a68011823 /AC aDLCcDLC aPZ7.H5347bHo a{Fic} aFbHig a 00000828 a0000000029 aHigdon, Hal aThe Horse that played center field /cby Hal Higdon. aNew York, N.Y. :bHolt, Rinehart and Winston,cc1969. a118 p. ;c22 cm. aAfter Oscar the horse began playing center field, the New York Goats, worst team in the major leagues, seemed certain to win the World Series, and then--Oscar was horse-naped. aHorsesxFiction aBaseballxFiction a87 a0000000029 a87hFp00101717t1b iHig01174cam 2200313 4500001001100000005001700011008003900028010001700067040002400084041001100108050001700119082001000136092001100146035001600157035001500173035001500785100002700188245008500215250001400300260004200314300003300356500007700389520022700466650003300693700002800726852006000800945001600754995001500770000000000420000427061119.0690410c19681967maua j 000 1 eng a68015390 /AC aDLCcDLCdm.c.dSER aEngger aPZ7.S829bQe a{Fic} aFbSte a 00000939 a0000000043 aStephan, Hanna,d1902- aThe Quest.cTranslated by Daphne Machin Goodall. Illustrated by Antony Maitland. a{1st ed.} aBoston,bLittle, Brownc{1968, c1967} aviii, 216 p.billus.c21 cm. aLondon ed. (Heinemann) published in 1967 under title: The long way home. aCaptured and adopted by a Russian officer during World War II when he is five years old, a German boy spends the next nine years wandering throughout Asia in an attempt to return home to a mother he only vaguely remembers. aVoyages and travelsxFiction aMaitland, Antony,d1935 aJc1n76680 a87a61a88 a0000000043 a87hFp00101784t1b iSte00813cam 2200265 4500001001100000005001700011008003900028010001700067040001300084050001900097082001000116092001100126035001600137035001500153035001500472100001600168245005700184250001400241260003000255300003300285520011800318650002100436852006000487995001500457000000000520000427061119.0690505s1969 nyua j 000 1 eng a68017524 /AC aDLCcDLC aPZ10.3.J77bKo a{Fic} aFbJoh a 00001003 a0000000050 aJones, Liza aKolo the panda;bstory and pictures,cby Liza Jones. a{1st ed.} aNew York,bNortonc{1969} a{48} p.billus.c21 x 26 cm. aUnhappy with their life at the zoo, the animals, led by the elephant and the panda, plot and carry out an escape. aAnimalsxFiction a68a86a87 a0000000050 a87hFp00101838t1b iJon