Index: trunk/ippTools/src/pztool.c
===================================================================
--- trunk/ippTools/src/pztool.c	(revision 16313)
+++ trunk/ippTools/src/pztool.c	(revision 16334)
@@ -344,4 +344,7 @@
     PXOPT_LOOKUP_STR(uri, config->args, "-uri", true, false);
 
+    // default values
+    PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
+
     // need to know exp_name, camera, telescope, class, class_id (to find the
     // pzPendingImfile entry and the URI for the newImfile entry.
@@ -360,4 +363,5 @@
             "       pzPendingImfile.*,"
             "       '%s'" // uri of downloaded file
+            "       '%d'" // fault code
             "   FROM pzPendingImfile"
             "   WHERE"
@@ -368,5 +372,5 @@
             "       AND pzPendingImfile.class_id = '%s'";
 
-        if (!p_psDBRunQuery(config->dbh, query, uri, exp_name, camera, telescope, class, class_id)) {
+        if (!p_psDBRunQuery(config->dbh, query, uri, exp_name, camera, telescope, class, class_id, code)) {
             // rollback
             if (!psDBRollback(config->dbh)) {
Index: trunk/ippTools/src/pztoolConfig.c
===================================================================
--- trunk/ippTools/src/pztoolConfig.c	(revision 16313)
+++ trunk/ippTools/src/pztoolConfig.c	(revision 16334)
@@ -122,4 +122,6 @@
     psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-end_stage",  0,
         "define the end goal processing step", NULL);
+    psMetadataAddS16(copydoneArgs, PS_LIST_TAIL, "-code",  0,
+            "set fault code", 0);
 
     psMetadata *argSets = psMetadataAlloc();
