Index: trunk/ippToPsps/src/ippToPsps.c
===================================================================
--- trunk/ippToPsps/src/ippToPsps.c	(revision 28205)
+++ trunk/ippToPsps/src/ippToPsps.c	(revision 28249)
@@ -93,5 +93,4 @@
     if (this->numOfInputFiles < 1) return false;
 
-
     this->inputFiles = (char**)calloc(this->numOfInputFiles, sizeof(char*));
     for(uint32_t i=0; i<this->numOfInputFiles; i++)
@@ -145,4 +144,5 @@
     psMetadataAddStr(arguments, PS_LIST_TAIL, "-expid", 0, "Exposure ID", NULL);
     psMetadataAddStr(arguments, PS_LIST_TAIL, "-expname", 0, "Exposure name", NULL);
+    psMetadataAddStr(arguments, PS_LIST_TAIL, "-survey", 0, "Survey type", NULL);
     psMetadataAddStr(arguments, PS_LIST_TAIL, "-input", 0, "Path to FITS inout", NULL);
     psMetadataAddStr(arguments, PS_LIST_TAIL, "-output", 0, "Path to FITS output", NULL);
@@ -163,4 +163,5 @@
         //free(tmp); tmp = NULL;
         this->expName = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-expname"));
+        this->surveyType = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-survey"));
         this->fitsInPath = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-input"));
         this->resultsPath = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-results"));
@@ -179,4 +180,5 @@
         if (
                 (this->batchType != BATCH_INIT && !this->expName) || 
+                (this->batchType != BATCH_INIT && !this->surveyType) || 
                 (this->batchType != BATCH_INIT && !this->fitsInPath) || 
                 (this->batchType != BATCH_INIT && !this->resultsPath) || 
@@ -241,4 +243,5 @@
     this->expId = -1;
     this->expName = NULL;
+    this->surveyType = NULL;
     this->fitsInPath = NULL;
     this->resultsPath = NULL;
Index: trunk/ippToPsps/src/ippToPsps.h
===================================================================
--- trunk/ippToPsps/src/ippToPsps.h	(revision 28205)
+++ trunk/ippToPsps/src/ippToPsps.h	(revision 28249)
@@ -22,4 +22,5 @@
     uint32_t expId;            // the exposure ID to be used
     psString expName;          // the exposure name
+    psString surveyType;       // the survey type, eg 3PI, MD01, STS, SSS
     uint8_t batchType;         // PSPS batch type
     psString fitsInPath;       // path to FITS input
Index: trunk/ippToPsps/src/ippToPspsBatchDetection.c
===================================================================
--- trunk/ippToPsps/src/ippToPspsBatchDetection.c	(revision 28205)
+++ trunk/ippToPsps/src/ippToPspsBatchDetection.c	(revision 28249)
@@ -65,9 +65,10 @@
     fits_write_col(this->fitsOut, TSTRING, FRAMEMETA_FRAMENAME, 1, 1, 1, &this->expName, &status);
 
-    int8_t surveyID = 0; // TODO
+    int8_t surveyID = -1;
+    if (!ippToPspsConfig_getSurveyId(this->config, this->surveyType, &surveyID)) {return PS_EXIT_DATA_ERROR;}
     fits_write_col(this->fitsOut, TBYTE, FRAMEMETA_SURVEYID, 1, 1, 1, &surveyID, &status);
 
     int8_t filterID = -1;
-    ippToPspsConfig_getFilterId(this->config, filterType, &filterID);
+    if (!ippToPspsConfig_getFilterId(this->config, filterType, &filterID)) {return PS_EXIT_DATA_ERROR;}
     fits_write_col(this->fitsOut, TBYTE, FRAMEMETA_FILTERID, 1, 1, 1, &filterID, &status);
 
Index: trunk/ippToPsps/src/ippToPspsConfig.c
===================================================================
--- trunk/ippToPsps/src/ippToPspsConfig.c	(revision 28205)
+++ trunk/ippToPsps/src/ippToPspsConfig.c	(revision 28249)
@@ -325,4 +325,18 @@
 
     return ret;
+}
+
+// gets survey ID from survey name
+bool ippToPspsConfig_getSurveyId(IppToPspsConfig* this, const char* surveyType, int8_t* surveyId) {
+
+    char buffer[10];
+    if (!ippToPspsConfig_getInitValue(this, "Survey", "name", surveyType, "surveyID", buffer)) {
+
+        *surveyId = -1;
+        return false;
+    }
+
+    *surveyId = atoi(buffer);
+    return true;
 }
 
Index: trunk/ippToPsps/src/ippToPspsConfig.h
===================================================================
--- trunk/ippToPsps/src/ippToPspsConfig.h	(revision 28205)
+++ trunk/ippToPsps/src/ippToPspsConfig.h	(revision 28249)
@@ -59,4 +59,5 @@
 // getters
 bool ippToPspsConfig_getFilterId(IppToPspsConfig* this, const char* filterType, int8_t* filterId);
+bool ippToPspsConfig_getSurveyId(IppToPspsConfig* this, const char* surveyType, int8_t* surveyId);
 
 #endif // IPPTOPSPSCONFIG_H
