#print "inserting /$dsid/$n/$npaper/ in Datasets<br>\n";
&dbase0("insert into Datasets set DATASET_ID=$dsid,LocalId=$n,_paper_PAPER_ID=$npaper");
&filter($dscomment[$n]);
#print "inserting /$dsid/$dscomment[$n]/ in DatasetComments<br>\n";
&dbase0("insert into DatasetComments set DATASET_ID=$dsid,Comments='$dscomment[$n]',Posn=0");
#print "inserting /$dsid/$location[$n]/ in DatasetComments<br>\n";
&dbase0("insert into DatasetComments set DATASET_ID=$dsid,Comments='$location[$n]',Posn=1");
foreach $r (1...$ndsreac[$n]){
$posn=$r-1;
&filter($dsreac[$n][$r]);
#print "inserting /$dsid/$dsreac[$n][$r]/$posn/ in DsReactions<br>\n";
&dbase0("insert into DsReactions set DATASET_ID=$dsid,DsReactions='$dsreac[$n][$r]',Posn=$posn");
}
foreach $o (1...$ndsobs[$n]){
$posn=$o-1;
#print "inserting /$dsid/$dsobs[$n][$o]/$posn/ in DsObservables<br>\n";
&dbase0("insert into DsObservables set DATASET_ID=$dsid,DsObservables='$dsobs[$n][$o]',Posn=$posn");
}
foreach $p (1...$ndsplab[$n]){
$posn=$p-1;
&dbase0("insert into DSPlabs set DATASET_ID=$dsid,DsPlabs='$dsplab[$n][$p]',Posn=$posn");
}
foreach $err (1...$ndserr[$n]){
$posn=$err-1;
print "inserting /$dsid/$dserr[$n][$err]/$posn/$dserrcom[$n][$err]/ in DatasetErrors<br>\n";
&dbase0("insert into DatasetErrors set DATASET_ID=$dsid,PlusError='$dserr[$n][$err]',MinusError='$dserr[$n][$err]',Comment='$dserrcom[$n][$err]',Source='SYS',Norm='PCT',LocalId=$posn");
}
foreach $b (1...$nx[$n]){
$axisid++;
&dbase0("insert into XAxes set AXIS_ID=$axisid,LocalId=$b,_dataset_DATASET_ID=$dsid,Header='$xhead[$n][$b]'");