Index: trunk/pswarp/src/pswarpParseCamera.c
===================================================================
--- trunk/pswarp/src/pswarpParseCamera.c	(revision 14768)
+++ trunk/pswarp/src/pswarpParseCamera.c	(revision 14874)
@@ -4,4 +4,5 @@
 
     bool status;
+    bool mdok;                          // Status of MD lookup
     pmFPAfile *skycell = NULL;
     pmConfig *skyConfig = NULL;
@@ -89,7 +90,22 @@
     }
 
+    if (psMetadataLookupBool(&mdok, config->arguments, "PSF")) {
+        // This file, PSPHOT.INPUT, is just used as a carrier; output files (eg, PSPHOT.RESID) are defined by
+        // psphotDefineFiles
+        pmFPAfile *psphotInput = pmFPAfileDefineFromFPA(config, output->fpa, 1, 1, "PSPHOT.INPUT");
+        if (!psphotInput) {
+            psError(PS_ERR_IO, false, _("Unable to generate output file from PSPHOT.INPUT"));
+            return false;
+        }
+
+        // Define associated psphot input/output files
+        if (!psphotDefineFiles(config, psphotInput)) {
+            psError(PSPHOT_ERR_CONFIG, false,
+                    "Unable to define the additional input/output files for psphot");
+            return false;
+        }
+    }
 
     // Chip selection: turn on only the chips specified
-    bool mdok;                          // Status of MD lookup
     char *chipLine = psMetadataLookupStr(&mdok, config->arguments, "CHIP_SELECTIONS");
     if (mdok) {
