Index: trunk/tools/bills/joinstkcmf
===================================================================
--- trunk/tools/bills/joinstkcmf	(revision 38884)
+++ trunk/tools/bills/joinstkcmf	(revision 38887)
@@ -21,4 +21,5 @@
 
 my ($stack_id, $skycal_id);
+my $test;
 my ($save_temps, $verbose);
 my $ofmt;
@@ -26,6 +27,7 @@
 GetOptions(
     "stack_id|s=s"      =>  \$stack_id,
+    "test"              =>  \$test,
     "ofmt=s"            =>  \$ofmt,
-    "vebose|v"          =>  \$verbose,
+    "verbose|v"          =>  \$verbose,
     "save-temps"        =>  \$save_temps,
 ) or pod2usage( 2 );
@@ -56,8 +58,21 @@
 }
 
-my ($proj, $cell);
-(undef, undef, undef, $proj, $cell, undef, $stack_id, undef, $skycal_id) = split '\.', $infilename;;
+my ($proj, $cell, $skycell_id);
+if (!$test) {
+    (undef, undef, undef, $proj, $cell, undef, $stack_id, undef, $skycal_id) = split '\.', $infilename;;
 
-my $skycell_id = sprintf "skycell.%04d.%03d", $proj, $cell;
+    $skycell_id = sprintf "skycell.%04d.%03d", $proj, $cell;
+} else {
+    (undef, $stack_id) = split '\.', $infilename;
+    $stack_id += 0;
+    $skycal_id = $stack_id;
+    my $results = `ftlist $path k include=SKYCELL | head -1`;
+    chomp $results;
+    print "$results\n";
+    (undef, undef, $skycell_id) = split " ", $results;
+    (undef, $proj, $cell) = split '\.', $skycell_id;
+    $cell += 0;
+    $proj += 0;
+}
 
 print "$stack_id $skycal_id $skycell_id\n" if $verbose;
