Index: trunk/ippTools/src/disttool.c
===================================================================
--- trunk/ippTools/src/disttool.c	(revision 23842)
+++ trunk/ippTools/src/disttool.c	(revision 23861)
@@ -41,4 +41,5 @@
 static bool pendingfilesetMode(pxConfig *config);
 static bool addfilesetMode(pxConfig *config);
+static bool pendingdatastoresMode(pxConfig *config);
 
 # define MODECASE(caseName, func) \
@@ -71,4 +72,5 @@
         MODECASE(DISTTOOL_MODE_PENDINGFILESET, pendingfilesetMode);
         MODECASE(DISTTOOL_MODE_ADDFILESET, addfilesetMode);
+        MODECASE(DISTTOOL_MODE_PENDINGDATASTORES, pendingdatastoresMode);
         default:
             psAbort("invalid option (this should not happen)");
@@ -893,2 +895,75 @@
 }
 
+static bool pendingdatastoresMode(pxConfig *config)
+{
+    PS_ASSERT_PTR_NON_NULL(config, false);
+#ifdef notyet
+
+    psMetadata *where = psMetadataAlloc();
+    PXOPT_COPY_S64(config->args, where, "-dist_id", "dist_id", "==");
+    PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
+
+    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
+    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
+
+    // look for "inputs" that need to processed
+    psString query = pxDataGet("disttool_pendingfileset.sql");
+    if (!query) {
+        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
+        return false;
+    }
+
+    if (psListLength(where->list)) {
+        psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
+        psStringAppend(&query, " AND %s", whereClause);
+        psFree(whereClause);
+    }
+    psFree(where);
+
+    // treat limit == 0 as "no limit"
+    if (limit) {
+        psString limitString = psDBGenerateLimitSQL(limit);
+        psStringAppend(&query, " %s", limitString);
+        psFree(limitString);
+    }
+
+    if (!p_psDBRunQuery(config->dbh, query)) {
+        psError(PS_ERR_UNKNOWN, false, "database error");
+        psFree(query);
+        return false;
+    }
+    psFree(query);
+
+    psArray *output = p_psDBFetchResult(config->dbh);
+    if (!output) {
+        psErrorCode err = psErrorCodeLast();
+        switch (err) {
+            case PS_ERR_DB_CLIENT:
+                psError(PXTOOLS_ERR_SYS, false, "database error");
+            case PS_ERR_DB_SERVER:
+                psError(PXTOOLS_ERR_PROG, false, "database error");
+            default:
+                psError(PXTOOLS_ERR_PROG, false, "unknown error");
+        }
+
+        return false;
+    }
+    if (!psArrayLength(output)) {
+        psTrace("disttool", PS_LOG_INFO, "no rows found");
+        psFree(output);
+        return true;
+    }
+
+    if (psArrayLength(output)) {
+        // negative simple so the default is true
+        if (!ippdbPrintMetadatas(stdout, output, "pendingfileset", !simple)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to print array");
+            psFree(output);
+            return false;
+        }
+    }
+
+    psFree(output);
+# endif // notdef
+    return true;
+}
Index: trunk/ippTools/src/disttool.h
===================================================================
--- trunk/ippTools/src/disttool.h	(revision 23842)
+++ trunk/ippTools/src/disttool.h	(revision 23861)
@@ -35,4 +35,5 @@
     DISTTOOL_MODE_PENDINGFILESET,
     DISTTOOL_MODE_ADDFILESET,
+    DISTTOOL_MODE_PENDINGDATASTORES,
 } disttoolMode;
 
Index: trunk/ippTools/src/disttoolConfig.c
===================================================================
--- trunk/ippTools/src/disttoolConfig.c	(revision 23842)
+++ trunk/ippTools/src/disttoolConfig.c	(revision 23861)
@@ -138,4 +138,13 @@
     psMetadataAddStr(addfilesetArgs, PS_LIST_TAIL, "-name", 0, "define file name", NULL);
     psMetadataAddS32(addfilesetArgs, PS_LIST_TAIL, "-fault", 0, "define fault code", 0);
+    //
+    // -pendingfileset
+    psMetadata *pendingdatastoresArgs = psMetadataAlloc();
+    psMetadataAddS64(pendingdatastoresArgs, PS_LIST_TAIL, "-dist_id", 0, "define dist_id", 0);
+    psMetadataAddStr(pendingdatastoresArgs, PS_LIST_TAIL, "-label",    0, "limit results to label", NULL);
+    psMetadataAddStr(pendingdatastoresArgs, PS_LIST_TAIL, "-stage",    0, "limit results to runs for stage", NULL);
+    psMetadataAddU64(pendingdatastoresArgs, PS_LIST_TAIL, "-limit",  0,  "limit result set to N items", 0);
+    psMetadataAddBool(pendingdatastoresArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false);
+
     psMetadata *argSets = psMetadataAlloc();
     psMetadata *modes = psMetadataAlloc();
@@ -151,4 +160,5 @@
     PXOPT_ADD_MODE("-pendingfileset",      "", DISTTOOL_MODE_PENDINGFILESET, pendingfilesetArgs);
     PXOPT_ADD_MODE("-addfileset",      "", DISTTOOL_MODE_ADDFILESET, addfilesetArgs);
+    PXOPT_ADD_MODE("-pendingdatastores",      "", DISTTOOL_MODE_PENDINGDATASTORES, pendingdatastoresArgs);
 
     if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) {
