Index: trunk/psModules/src/camera/pmFPAfileDefine.c
===================================================================
--- trunk/psModules/src/camera/pmFPAfileDefine.c	(revision 21313)
+++ trunk/psModules/src/camera/pmFPAfileDefine.c	(revision 21314)
@@ -208,4 +208,12 @@
     file->camera = psMemIncrRefCounter(camera);
     file->cameraName = psMemIncrRefCounter(cameraName);
+
+    // Copy the file id valuves if they have been set in the config
+    if (config->sourceId) {
+        file->sourceId = config->sourceId;
+    }
+    if (config->imageId) {
+        file->imageId = config->imageId;
+    }
 
     // XXX this seems a bit of a hack: use the cameraName to determine the mosaic level...
Index: trunk/psModules/src/config/pmConfig.c
===================================================================
--- trunk/psModules/src/config/pmConfig.c	(revision 21313)
+++ trunk/psModules/src/config/pmConfig.c	(revision 21314)
@@ -156,4 +156,7 @@
     // the file structure is used to carry pmFPAfiles
     config->files = psMetadataAlloc ();
+
+    config->sourceId = 0;
+    config->imageId = 0;
     return config;
 }
@@ -917,4 +920,30 @@
             }
 
+            psArgumentRemove(argNum, argc, argv);
+        }
+    }
+
+    argNum = psArgumentGet(*argc, argv, "-image_id");
+    if (argNum > 0) {
+        psArgumentRemove(argNum, argc, argv);
+        if (argNum >= *argc) {
+            psWarning("-image_id command-line switch provided without the required id number");
+        } else {
+            if (!sscanf(argv[argNum], "%" PRId64, &config->imageId)) {
+                psWarning("Failed to parse image_id value %s", argv[argNum]);
+            }
+            psArgumentRemove(argNum, argc, argv);
+        }
+    }
+
+    argNum = psArgumentGet(*argc, argv, "-source_id");
+    if (argNum > 0) {
+        psArgumentRemove(argNum, argc, argv);
+        if (argNum >= *argc) {
+            psWarning("-source_id command-line switch provided without the required id number");
+        } else {
+            if (!sscanf(argv[argNum], "%" PRId64, &config->sourceId)) {
+                psWarning("Failed to parse image_id value %s", argv[argNum]);
+            }
             psArgumentRemove(argNum, argc, argv);
         }
Index: trunk/psModules/src/config/pmConfig.h
===================================================================
--- trunk/psModules/src/config/pmConfig.h	(revision 21313)
+++ trunk/psModules/src/config/pmConfig.h	(revision 21314)
@@ -5,6 +5,6 @@
  *  @author Eugene Magnier, IfA
  *
- *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2009-01-24 20:51:57 $
+ *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2009-02-05 19:41:50 $
  *  Copyright 2005-2006 Institute for Astronomy, University of Hawaii
  */
@@ -56,4 +56,6 @@
     int traceFD;                        ///< File descriptor for trace messages
     int logFD;                          ///< File descriptor for log messages
+    psS64 sourceId;                    ///< Database source id for output file
+    psS64 imageId;                     ///< Database image id for output file
 } pmConfig;
 
