--- trunk/IsisDB.pm 2004/12/29 15:10:34 7 +++ trunk/IsisDB.pm 2004/12/29 15:17:59 8 @@ -276,14 +276,17 @@ my @FieldLEN; my @FieldTAG; + read($self->{'fileMST'}, $buff, 6 * $NVF); + + my $fld_len = 0; + for (my $i = 0 ; $i < $NVF ; $i++) { # $TAG=$self->Read16($fileMST); # $POS=$self->Read16($fileMST); # $LEN=$self->Read16($fileMST); - read($self->{'fileMST'}, $buff, 6); - my ($TAG,$POS,$LEN) = unpack("sss", $buff); + my ($TAG,$POS,$LEN) = unpack("sss", substr($buff,$i * 6, 6)); print "TAG: $TAG POS: $POS LEN: $LEN\n" if ($self->{debug}); @@ -300,16 +303,18 @@ push @FieldTAG,$TAG; push @FieldPOS,$POS; push @FieldLEN,$LEN; + + $fld_len += $LEN; } # Get Variable Fields delete $self->{record}; + read($self->{'fileMST'},$buff,$fld_len); + for (my $i = 0 ; $i < $NVF ; $i++) { - my $rec; - read($self->{'fileMST'},$rec,$FieldLEN[$i]); - push @{$self->{record}->{$FieldTAG[$i]}}, $rec; + push @{$self->{record}->{$FieldTAG[$i]}}, substr($buff,$FieldPOS[$i],$FieldLEN[$i]); } close(fileMST);