#
# get_sf($isis_row,'isis_field'[,'subfield'])
#
# e.g. get_sf($row,'700','a')
#
sub get_sf {
	my $row = shift @_;
	my $isis_id = shift @_;
	my $subfield = shift @_;

	my $i = shift @_ || 0;

	my $out;

	if ($row->{$isis_id}->[$i]) {
		if (! $subfield) {
			# subfield list undef, empty or no defined subfields for this record
			my $all_sf = $row->{$isis_id}->[$i];
			$all_sf =~ s/\^./ /g;	# nuke definitions
			return $all_sf;	
		}
		my $sf = OpenIsis::subfields($row->{$isis_id}->[$i]);
		if ($sf->{$subfield}) {
			return $sf->{$subfield};
		}
	}
}

1;

