[Koha] Query Regarding MARC Records

Nicole Engard nengard at gmail.com
Sun Jul 18 02:45:13 NZST 2010


I'm not sure if I understand this right, but you don't need a script
to turn CSV into MARC - I believe you can use MARCEdit to do that:
http://people.oregonstate.edu/~reeset/marcedit/html/index.php

If that's not what you need then I'm not sure how to help with the
errors, that's someone else's expertise.

Nicole

On Sat, Jul 17, 2010 at 8:36 AM, rohitsingh <rohit.singh at rsg.co.in> wrote:
>
> Hello Everybody,
>
> I am working on how to create MARC records for books that do not have
> Library of
> Congress Data? and How we should be able to enter the data in to a CSV file?
>
> I have created a CSV File and saved as updated data.csv, i have written the
> code for creating MARC Record and saved it as rohit.pl i have saved this
> file in the document root directory i.e /koha/intranet/htdocs/rohit.pl and i
> tried to save in another locations also i.e /cgi-bin/koha/rohit.pl
>
> Rohit.pl contains the following code
>
> ## create a MARC::Record object.
> use MARC::Record;
> use Text::CSV;
>
> my $file = '/Users/keshwendu/desktop/updated data.csv';
> my $csv = Text::CSV->new();
>
> open (CSV, "<", $file) or die $!;
>
> ## To ignore the header
> my @columns = $csv->fields();
>
> while (<CSV>) {
>  if ($csv->parse($_)) {
>    my @columns = $csv->fields();
>
>    my $record = MARC::Record->new();
>
>    ## create a title field.
>    my $title = MARC::Field->new(
>      '245','','',
>      a => $columns[0], # title
>    );
>    $record->append_fields($title);
>
> ##CONTROL NUMBER IDENTIFIER
>    my $CONTROL NUMBER IDENTIFIER = MARC::Field->new(
>      '260','', '',
>      a => $columns[1], #place
>    );
>    $record->append_fields($CONTROL NUMBER IDENTIFIER);
>
>  ## DATE AND TIME OF LATEST TRANSACTION
>    my $DATE AND TIME OF LATEST TRANSACTION = MARC::Field->new(
>      '300', '', '',
>      b => $columns[2],
>    );
>    $record->append_fields($DATE AND TIME OF LATEST TRANSACTION);
>
> ## LIBRARY OF CONGRESS CONTROL NUMBER
>    my $LIBRARY OF CONGRESS CONTROL NUMBER = MARC::Field->new(
>      '942', '', '',
>      c => $columns[3], #LIBRARY OF CONGRESS CONTROL NUMBER
>    );
>    $record->append_fields($LIBRARY OF CONGRESS CONTROL NUMBER);
>
>  ## ISBN
>    my $isbn = MARC::Field->new(
>      '020', '', '',
>      a => $columns[4], #ISBN
>    );
>    $record->append_fields($isbn);
>
>
> ## CONTROL NUMBER
>    my $CONTROL NUMBER = MARC::Field->new(
>      '942', '', '',
>      c => $columns[5], #CONTROL NUMBER
>    );
>    $record->append_fields($CONTROL NUMBER);
>
>
>    ## create an author field.
>    my $author = MARC::Field->new(
>      '100', '', '',
>      a => $columns[6], #author
>    );
>    $record->append_fields($author);
>
>    ## open a filehandle to write to 'record.dat'.
>    open(OUTPUT, '>> record.mrc') or die $!;
>    print OUTPUT $record->as_usmarc();
>    close(OUTPUT);
>  }
>  else {
>    my $err = $csv->error_input;
>    print "Failed to parse line: $err";
>  }
> }
> close CSV;
>
> and my CSV file as below:
> http://old.nabble.com/file/p29191222/updated%2Bdata.csv updated+data.csv
>
>  when i saved this file in the document root directory i.e
> /koha/intranet/htdocs/rohit.pl or in some another locations i.e
> /cgi-bin/koha/rohit.pl
>
> i am getting the below error
>
> http://old.nabble.com/file/p29191222/Screen%2Bshot%2B2010-07-14%2Bat%2B4.27.00%2BPM.png
> Screen+shot+2010-07-14+at+4.27.00+PM.png
> http://old.nabble.com/file/p29191222/Screen%2Bshot%2B2010-07-17%2Bat%2B2.58.53%2BPM.png
> Screen+shot+2010-07-17+at+2.58.53+PM.png
>
>
> PLease help me out to how to create the MARC Records Programmatically? and
> How we should be able to enter the data in to a CSV file and then
> programaticaly create MARC records for upload in Koha eventually?
>
> Looking forward for your kind reply
>
> Thanks and Regards
> Rohit Singh
>
>
>
>
>
> --
> View this message in context: http://old.nabble.com/Query-Regarding-MARC-Records-tp29191222p29191222.html
> Sent from the Koha - Discuss mailing list archive at Nabble.com.
>
> _______________________________________________
> Koha mailing list
> Koha at lists.katipo.co.nz
> http://lists.katipo.co.nz/mailman/listinfo/koha
>


More information about the Koha mailing list