Index: trunk/ippTools/share/chiptool_change_imfile_data_state.sql
===================================================================
--- trunk/ippTools/share/chiptool_change_imfile_data_state.sql	(revision 23383)
+++ trunk/ippTools/share/chiptool_change_imfile_data_state.sql	(revision 23384)
@@ -1,7 +1,10 @@
 -- handle changes in data_state. Used for the modes tocleanedimfile and topurgedimfile
--- args are new data_state, chip_id, class_id, and current expected state for chipRun
+-- args are new data_state, a possibly empty string for updating the magicked state,
+-- chip_id and class_id
 UPDATE chipProcessedImfile
+JOIN rawImfile USING(exp_id, class_id)
     SET 
-    data_state = '%s'
+    chipProcessedImfile.data_state = '%s'
+    -- set magicked hook %s
 WHERE
     chip_id = %lld
