my $csigid =
	lookup(
		sub { rec('A') },
		'casopisi','csigid',
		sub { rec('A') },
		sub { rec('I') }
	);

if ( ! $csigid ) {


### LEADER

## LDR 05 - n - new
marc_leader('05','n');

## LDR 06 - a - language material 
marc_leader('06','a');

## LDR 07 - Bibliographic level 
marc_leader('07','s');

## LDR 17 - Encoding level ; 7 - minimal level, u - unknown
marc_leader('17','u');

## LDR 18 - i - isbd 
marc_leader('18','i');

### 008 - All materials
marc_fixed('008','00', '090820');	# 00-05 - Date entered on file

## za 008 06 treba i lookup u tablicu u kojoj postoji podatak o tome jel tekuci casopis ili nije?
## c - Continuing resource currently published
## d - Continuing resource ceased publication

marc_fixed('008','06','|');		# 06 - Type of date/Publication status, s = single know date, | = no attempt to code
marc_fixed('008','07','||||');
marc_fixed('008','11','||||');
marc_fixed('008','15','xx ');
					# 18-34 - Material specific coded elements 
					# 35-37 - Language
marc_fixed('008','38','|');		# 38 - Modified record
marc_fixed('008','39','d');		# 39 - Cataloging source

### 008 - Continuing resources

marc_fixed('008','18', '|');	# 18 - Frequency - ovo treba popuniti iz polja 326
marc_fixed('008','19', '|');	# 19 - Regularity
				# 20 - Undefined, ontains a blank (#) or fill character (|)

marc_fixed('008','21', 'p');	# 21 - Type of continuing resource

				# 22 - Form of original item - blank
				# 23 - Form of item
				# 24 - Nature of entire work
				# 25-27 - Nature of contents
				# 28 - Government publication
				# 29 - Conference publication
				# 30-32 - Undefined
				# 33 - Original alphabet or script of title
				# 34 - Entry convention
marc_fixed('008','22', ' ');
marc_fixed('008','23', ' ');
marc_fixed('008','24', '|');
marc_fixed('008','25', '|||');
marc_fixed('008','28', ' ');
marc_fixed('008','29', '|');
marc_fixed('008','33', '|');
marc_fixed('008','34', '0');

### 022

marc('022','a',
	rec('F')
);

### 035$a

marc('035','a',
	prefix('HR-ZaFF csig',
		rec('I') 
	),
);

### 040
# za sve je isti
# treba utvrditi točnu oznaku za ustanovu

marc('040','a',
	'HR FFZG'
);

marc('040','b',
	'hrv'
);

marc('040','c',
	'HR-ZaFF'
);

marc('040','e',
	'ppiak'
);


#_debug(3);


marc_indicators('245', 0, 0);

if ( 	( rec('E') =~ m/^Die /) || 
	( rec('E') =~ m/^Das /) || 
	( rec('E') =~ m/^Der /) || 
	( rec('E') =~ m/^Les /) || 
	( rec('E') =~ m/^The /) ) {
		marc_indicators('245', 0, 4);

} 

if (	( rec('E') =~ m/^Un /) || 
	( rec('E') =~ m/^An /) ||
	( rec('E') =~ m/^La /) ||
	( rec('E') =~ m/^Le /) ||
	( rec('E') =~ m/^Il /) ) {
		marc_indicators('245', 0, 3);
} 

if (	( rec('E') =~ m/^A /) || 
	( rec('E') =~ m/^L'/) ) {
		marc_indicators('245', 0, 2);
} 

### 245

my ($a,$b,$c);
my $naslov = rec('E');
$c = $2 if $naslov =~ s{(\s+/)\s+(.+)$}{$1};
if ( $naslov =~ s{^(.+?[:=])\s+}{} ) {
	$a = $1;
	$b = $naslov ;
} else {
	$a = $naslov ;
}


marc('245','a', $a);
marc('245','b', $b) if $b;
marc('245','c', $c);

#if ( rec('E') =~ m/:/ ) {
#	marc('245','a',
#		suffix(' :',
#			regex('s/(^.*):.*/$1/',
#				rec('E')
#			)
#		)
#	);
#	marc('245','b',
#		regex('s/^.*: (.*)/$1/',
#			rec('E')
#		)
#	);
#} else {
#	marc('245','a',
#		rec('E')
#	);
#}

marc('500','a',
	rec('H'),
);


### 866
marc_indicators('866',' ','0');
marc('866','a',
	rec('G')
);


### 942

marc('942','b',
	'PER'
);

marc('942','c',
	'PER'
);

marc('942','d',
	rec('C')
);

marc('942','i',
	rec('C')
);

} #csigid
