The code is off the top of my head and parts have been copied from a variety of Perl scripts I had hanging around. It isn't tested, but hopefully a start for your work.
Thanks, Andy, there's a lot there that I can put to good use. Much more elegant code than I could have written off the top of MY head.
At 21:10 7/05/2005, Ed Summers wrote:
It's ironic that MARC::Record *used* to do what Andrew suggests: using split() rather than
than substr() with the actual directory lengths. The reason for the switch was just as Andrew pointed out: the order of the tags in the directory is not necessarily the order of the field data.
Has anybody ever seen a MARC record where the order of the field data wasn't the same as that of the entries in the directory? I'm not questioning the logic of reading a record using the field lengths and offsets, just wondering if anybody had ever seen this occur in the wild. I never have.
Thanks again for your help and the confirmation that this kind of correction is a reasonable thing to do.
Ron
Ron Davies
Information and documentation systems consultant
Av. Baden-Powell 1 Bte 2, 1200 Brussels, Belgium
Email: ron(at)rondavies.be
Tel: +32 (0)2 770 33 51
GSM: +32 (0)484 502 393