Index: other-projects/nightly-tasks/diffcol/trunk/diffcol/diffcol.pl
===================================================================
--- other-projects/nightly-tasks/diffcol/trunk/diffcol/diffcol.pl	(revision 29494)
+++ other-projects/nightly-tasks/diffcol/trunk/diffcol/diffcol.pl	(revision 29495)
@@ -58,4 +58,5 @@
 }
 
+$gv_blnDebugging = 0;
 $gv_blnErrorStop = "false";
 $gv_blnErrorShow = "false";
@@ -334,5 +335,5 @@
     {
 	#my $strGdbError = gdbdiff::test_gdb($strModelGdb, $strTestGdb);
-	$strGdbError = gdbdiff::test_gdb($strModelGdb, $strTestGdb, $strColName,$gv_test_os, $gv_model_os,$strTestCol,$strModelCol);
+	$strGdbError = gdbdiff::test_gdb($strModelGdb, $strTestGdb, $strColName,$gv_test_os, $gv_model_os,$strTestCol,$strModelCol, $gv_blnDebugging);
 	if($strGdbError ne "")
 	{
@@ -435,5 +436,5 @@
 		print "<error>usage incorrect</error>\n";
 	} else {
-		print STDERR "Usage: $strProgName test-col [more-col] [-verbosity d] [-mode modes] [-eshow] [-estop]\n";
+		print STDERR "Usage: $strProgName test-col [more-col] [-verbosity d] [-mode modes] [-eshow] [-estop] [-debug]\n";
 	}
 	Help("Error: used incorrect parameters");
@@ -455,9 +456,13 @@
 		'type' => "flag",
 		'argu' => "NULL" ,
-		'descrip' => "Set then system will stop once it meet an error"},
+		'descrip' => "Set then system will stop once it meets an error"},
 	  { 'name' => "eshow",
 		'type' => "flag",
 		'argu' => "NULL" ,
-		'descrip' => "Set then system will show the error summary"}
+		'descrip' => "Set then system will show the error summary"},
+	  { 'name' => "debug",
+		'type' => "flag",
+		'argu' => "NULL" ,
+		'descrip' => "If set, stores intermediate diff files in toplevel diffcol folder"}
 	  ];
 	
@@ -749,12 +754,14 @@
 		} # finished special processing of doc.xml files
 		
-		my $savepath = &getcwd."/../"; # TASK_HOME env var does not exist at this stage, but it's one level up from current directory		
-#		&gdbdiff::print_string_to_file($model_contents, $savepath."model_docmets.xml");
-#		&gdbdiff::print_string_to_file($test_contents, $savepath."test_docmets.xml");
-#		if($strModel =~ m/(HASH0164.dir)/) { # list the HASH dirs for which you want the doc.xml file generated, to inspect specific doc.xml files
-#		&gdbdiff::print_string_to_file($model_contents, $savepath."$1_model_doc.xml");
-#		&gdbdiff::print_string_to_file($test_contents, $savepath."$1_test_doc.xml");
-#		}
-		
+
+		if($gv_blnDebugging) {# && $gv_intVerbosity > 0) {
+		    my $savepath = &getcwd."/../"; # TASK_HOME env var does not exist at this stage, but it's one level up from current directory		
+		    &gdbdiff::print_string_to_file($model_contents, $savepath."model_docmets.xml");
+		    &gdbdiff::print_string_to_file($test_contents, $savepath."test_docmets.xml");
+#		    if($strModel =~ m/(HASH0164.dir)/) { # list the HASH dirs for which you want the doc.xml file generated, to inspect specific doc.xml files
+#			&gdbdiff::print_string_to_file($model_contents, $savepath."$1_model_doc.xml");
+#			&gdbdiff::print_string_to_file($test_contents, $savepath."$1_test_doc.xml");
+#		    }
+		}		
 
 		
@@ -950,5 +957,5 @@
 sub main
 {
-	my ($intVerbosity,$strErrorStop,$strErrorShow,$strMode,$test_os,$model_os);
+	my ($intVerbosity,$strErrorStop,$strErrorShow,$strMode,$test_os,$model_os,$debugging);
 	my $strProgName = $0; 
 	my $intArgc = scalar(@ARGV);
@@ -958,4 +965,5 @@
 		'estop//off', \$strErrorStop, 
 		'eshow//off', \$strErrorShow, 
+		'debug', \$debugging, 
 		'verbosity/\d+/1', \$intVerbosity, 
 		'mode/[\w\-]+/all', \$strMode,
@@ -976,4 +984,5 @@
 	$gv_model_os = $model_os; # tends to be linux
 
+	$gv_blnDebugging = $debugging;
 	$gv_blnErrorStop = $strErrorStop;
 	$gv_blnErrorShow = $strErrorShow;
Index: other-projects/nightly-tasks/diffcol/trunk/diffcol/gdbdiff.pm
===================================================================
--- other-projects/nightly-tasks/diffcol/trunk/diffcol/gdbdiff.pm	(revision 29494)
+++ other-projects/nightly-tasks/diffcol/trunk/diffcol/gdbdiff.pm	(revision 29495)
@@ -73,5 +73,5 @@
 sub test_gdb
 {
-    my ($full_modeldb, $full_testdb, $strColName, $test_os, $model_os, $strTestCol, $strModelCol) = @_;
+    my ($full_modeldb, $full_testdb, $strColName, $test_os, $model_os, $strTestCol, $strModelCol, $debugging) = @_;
 
    # print "Now is testing database\n";
@@ -81,7 +81,9 @@
     my $test_text = read_db($full_testdb);
 
-#	my $savepath = &getcwd."/../"; # TASK_HOME env var does not exist at this stage, but it's one level up from current directory
-#	print_string_to_file($test_text, $savepath.$dbname."_test.out1");	
-#	print_string_to_file($model_text, $savepath.$dbname."_model.out1");
+    my $savepath = &getcwd."/../"; # TASK_HOME env var does not exist at this stage, but it's one level up from current directory
+    if($debugging) {
+	print_string_to_file($test_text, $savepath.$dbname."_test.out1");	
+	print_string_to_file($model_text, $savepath.$dbname."_model.out1");
+    }
 
     # filter out the fields that can be ignored in the two database files
@@ -270,7 +272,10 @@
 	}	
 
-	# now can go back to using $model_text and $test_text
-#	print_string_to_file($test_text, $savepath.$dbname."_test.out");	
-#	print_string_to_file($model_text, $savepath.$dbname."_model.out");
+    # now can go back to using $model_text and $test_text
+
+    if($debugging) {
+	print_string_to_file($test_text, $savepath.$dbname."_test.out");	
+	print_string_to_file($model_text, $savepath.$dbname."_model.out");
+    }
 	
     my $report_type = "OldStyle"; # Can not change this type.
Index: other-projects/nightly-tasks/diffcol/trunk/task.pl
===================================================================
--- other-projects/nightly-tasks/diffcol/trunk/task.pl	(revision 29494)
+++ other-projects/nightly-tasks/diffcol/trunk/task.pl	(revision 29495)
@@ -864,5 +864,6 @@
 	my $debug_state = $debugging ? "-debug" : "";
 	$cmd = "diffcol.pl -testos $test_os -modelos $model_os -output xml -verbosity 10 $debug_state $collection"; # need to run with ./diffcol.pl if bash script
-	
+
+	#print STDERR "Running diffcol cmd: $cmd\n";
 	&run_diff_script($cmd, $xml_fh, $diffcol_dir);
 
