Re: Ignoring deleted records in Biblio::ISIS

[email protected] ("Saiful Amin")
Newsgroups perl.perl4lib
Message-ID <[email protected]>
On Wed, May 28, 2008 at 8:29 PM, Dobrica Pavlinusic <[email protected]>
wrote:

> On Tue, May 27, 2008 at 01:03:22PM +0530, Saiful Amin wrote:
> > You can download the sample database of 50 records, in which MFN 18 and
> 19
> > are logically deleted, from the following link:
> > http://122.166.0.252/sample.zip
>
> I can't reproduce your problem. When I try to dump your records using
> dump_isisdb.pl included in Bibio::ISIS distribution (with options to start
> at record 17, and dump just 4 records) I get:
>
> I would love to help you with this, but I'm puzzled.
>

I didn't know about the dump script. My script is quite a long one. I'm
attaching a portion of that script which is not able to ignore the logically
deleted records.

-- 
Saiful Amin
+91 9343826438
ccf2marc21.pl.txt (text/plain, 3.2 KB)
#!/usr/bin/perl
# 
# Name: ccf2marc.pl 
# Author: Saiful Amin <[email protected]>
# Date: May 2008
# Version: 0.4
# Description: Takes the CDS/ISIS as input and gives valid MARC21 data as output.
# 

use strict;
use warnings;
#use diagnostics;
use Biblio::Isis;
use MARC::Record;

# Usage Instructions
die "\nUSAGE: $0 Output_file\n" unless defined $ARGV[0];

# Open the ISIS Database
my $isis = new Biblio::Isis (
	isisdb => 'C:/WINISIS/DATA/sample/',
	#include_deleted => 0,
	debug => 0
);

open (OUTFILE, ">$ARGV[0]");

my $num = 0;

###################################################

for (my $mfn = 1; $mfn <= $isis->count; $mfn++) {
	my $marc = MARC::Record->new();
	my $record = $isis->to_hash($mfn);

	my $first_author_a = $$record{300}[0]{a};
	my $first_author_b = $$record{300}[0]{b};
	my $first_author_e = $$record{300}[0]{f};
	
	my $corp_author_a = $$record{310}[0]{a};
	my $corp_author_b = $$record{310}[0]{b};
	my $corp_author_c = $$record{310}[0]{d};
	my $corp_author_cc = $$record{310}[0]{e};

	my $field_245a = $$record{200}[0]{a};
	my $field_245c = $$record{200}[0]{b};
	
	my $conf_author_a = $$record{320}[0]{a};
	my $conf_author_cc = $$record{320}[0]{e};
	my $conf_author_c = $$record{320}[0]{g};
	my $conf_author_d = $$record{320}[0]{h};
	my $conf_author_n = $$record{320}[0]{j};
	
	$num++;

###################################################
# Create the Leader and map with relevant codes
###################################################

	# Prepare the Leader
	my $leader = '00054nam#a22002891a 4500';
	$marc->leader($leader);

###################################################
# Create the fixed field tags (007/008)
###################################################

	my $data_008 = '080528|                r|    ||111|eng||||';
	my $tag_008 = MARC::Field->new('008', $data_008);
	$marc->append_fields($tag_008);

#######################################################
# Create the first author (Main Entry/Added Entry)
#######################################################

	# First author in tag_100
	if ($first_author_a) {
		my $first_author = "$first_author_a";
		$first_author .= ", $first_author_b" if $first_author_b;
		my $main_author = '';
		
		if ($corp_author_a || $conf_author_a) {
			$main_author = MARC::Field->new('700', 1,'', 'a' => '');
		} else {
			$main_author = MARC::Field->new('100', 1,'', 'a' => '');
		}
		$main_author->update('a' => $first_author);
		$main_author->update('e' => $first_author_e) if $first_author_e;
		$marc->append_fields($main_author);
	}

#######################
## The Title Section ##
#######################

	my $title = $field_245a;
	my $state_of_resp = '';
	
	if ($field_245c) {
		$state_of_resp = $field_245c;
	}
	
	#print "$mfn\n" if !defined $title;
	$title = "No title found" if !defined $title;
	
	# Create Title field
	my $tag_245 = MARC::Field->new('245',1,0,
		'a' => "$title"
	);
	$tag_245->update('c' => $state_of_resp) if $state_of_resp;
	$marc->append_fields($tag_245);

###################################################
#  Write output to OUTFILE
###################################################

	print OUTFILE $marc->as_usmarc();
	print STDOUT "Printed record number $mfn\n";
}
close (OUTFILE);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.