open (IN,"<r.csv");
while (<IN>){
    chomp;
    $text=$_;
    # remove leading whitespace
    $text =~ s/^\s+//;
# remove trailing whitespace
    $text =~ s/\s+$//;
    @parts=split /\s+/, $text;
    print "$parts[0] : $parts[1] : $parts[2]  \n";
    $gzFile="bin_". $parts[2].".gz";
    print "gz $gzFile \n";
    unless (-e $gzFile) {
    unless (-e $parts[2]) {
	print "$parts[2] does not exist \n";
	$imcopy=$text;
        print "doing $imcopy \n";
 #       $outi=`$imcopy`;
    }
    $fCmd="fimgbin $parts[2] $gzFile 3";
    print "doing  $fCmd \n";
#    $out=`$fCmd`;
    print $out;
    if (-e $gzFile) {
        print "doing unlink \n";
        unlink $parts[2];
    }    
    }
    if (-e $gzFile) {
        print "doing fcarith \n";
        $fcarith= "fcarith  $gzFile 9 \\!$gzFile DIV";
        print "$fcarith \n";
        $fout=`$fcarith `;
        print "$fout \n";
    }


}
