Index: /branches/pap_mops/dbconfig/publish.md
===================================================================
--- /branches/pap_mops/dbconfig/publish.md	(revision 24426)
+++ /branches/pap_mops/dbconfig/publish.md	(revision 24427)
@@ -3,7 +3,6 @@
 publishClient   METADATA 
     client_id   S64         0       # Primary Key AUTO_INCREMENT
+    product     STR	    64
     stage	STR	    64
-    destination STR	    255
-    format      STR	    64
     comment     STR         255
 END
@@ -13,11 +12,12 @@
     client_id   S64         0
     stage_id    S64         0
+    workdir     STR	    255
     label       STR         64
     state       STR         64
 END
 
-publishFile	METADATA
+publishDone	METADATA
     pub_id      S64         0       # Primary Key
-    component	STR	    64	    # Primary Key
+    path_base	STR	    255
     fault	S16	    0
 END
Index: /branches/pap_mops/ippScripts/Build.PL
===================================================================
--- /branches/pap_mops/ippScripts/Build.PL	(revision 24426)
+++ /branches/pap_mops/ippScripts/Build.PL	(revision 24427)
@@ -90,4 +90,5 @@
         scripts/receive_setstatus.pl
         scripts/rcserver_checkstatus.pl
+        scripts/publish_file.pl
     )],
     dist_abstract => 'Scripts for running the Pan-STARRS IPP',
Index: /branches/pap_mops/ippScripts/scripts/publish_file.pl
===================================================================
--- /branches/pap_mops/ippScripts/scripts/publish_file.pl	(revision 24427)
+++ /branches/pap_mops/ippScripts/scripts/publish_file.pl	(revision 24427)
@@ -0,0 +1,185 @@
+#!/usr/bin/env perl
+
+use warnings;
+use strict;
+
+## report the program and machine
+use Sys::Hostname;
+my $host = hostname();
+print "Starting script $0 on $host\n\n";
+
+use DateTime;
+my $mjd_start = DateTime->now->mjd;   # MJD of starting script
+
+use vars qw( $VERSION );
+$VERSION = '0.01';
+
+use IPC::Cmd 0.36 qw( can_run run );
+use PS::IPP::Metadata::Config;
+use PS::IPP::Metadata::List qw( parse_md_list );
+use PS::IPP::Config 1.01 qw( :standard );
+use File::Temp qw( tempfile );
+use File::Basename qw( basename );
+use Carp;
+
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+use Pod::Usage qw( pod2usage );
+
+# Look for programs we need
+my $missing_tools;
+my $pubtool = can_run('pubtool') or (warn "Can't find pubtool" and $missing_tools = 1);
+my $camtool = can_run('camtool') or (warn "Can't find camtool" and $missing_tools = 1);
+my $difftool = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1);
+my $ppMops = can_run('ppMops') or (warn "Can't find ppMops" and $missing_tools = 1);
+my $dsreg = can_run('dsreg') or (warn "Can't find dsreg" and $missing_tools = 1);
+if ($missing_tools) {
+    warn("Can't find required tools.");
+    exit($PS_EXIT_CONFIG_ERROR);
+}
+
+# Parse the command-line arguments
+my ( $pub_id, $stage, $stage_id, $format, $product, $workdir );
+my ( $dbname, $verbose, $no_update, $save_temps );
+
+GetOptions(
+    'pub_id=s'          => \$pub_id, # Publish identifier
+    'stage=s'           => \$stage,       # Stage of interest
+    'stage_id=s'        => \$stage_id,    # Stage identifier
+    'product=s'         => \$product,     # Datastore product name
+    'workdir=s'         => \$workdir,     # Working directory
+    'dbname=s'          => \$dbname,    # Database name
+    'verbose'           => \$verbose,   # Print to stdout
+    'no-update'         => \$no_update, # Don't update the database?
+    'save-temps'        => \$save_temps, # Save temporary files?
+    ) or pod2usage( 2 );
+
+pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
+pod2usage( -msg => "Required options: --pub_id --stage --stage_id --product --workdir",
+           -exitval => $PS_EXIT_CONFIG_ERROR) unless
+    defined $pub_id and
+    defined $product and
+    defined $stage and
+    defined $stage_id and
+    defined $workdir;
+
+my $ipprc = PS::IPP::Config->new() or
+    &my_die( "Unable to set up", $pub_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
+
+my $mdcParser = PS::IPP::Metadata::Config->new;
+
+
+# Retrieve file name of interest
+my %files;                      # Input filenames
+my %zp;                         # Zero points
+{
+    my $command;                # Command to run
+
+    if ($stage eq 'diff') {
+        $command =  "difftool -skyfile -diff_id $stage_id";
+    } elsif ($stage eq 'camera') {
+        $command =  "camtool -processedexp -cam_id $stage_id";
+    } else {
+        &my_die( "Unrecognised stage: $stage", $pub_id, $PS_EXIT_CONFIG_ERROR );
+    }
+
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+        run(command => $command, verbose => $verbose);
+    &my_die( "Unable to retrieve filename", $pub_id, $PS_EXIT_SYS_ERROR) unless $success;
+
+    my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
+        &my_die("Unable to parse metadata config", $pub_id, $PS_EXIT_PROG_ERROR);
+
+    my $components = parse_md_list($metadata) or
+        &my_die("Unable to parse metadata list", $pub_id, $PS_EXIT_PROG_ERROR);
+
+    foreach my $comp ( @$components ) {
+        my $path_base = $comp->{path_base}; # Base name for file
+
+        if ($stage eq 'diff') {
+            my $skycell_id = $comp->{skycell_id};
+            $files{"$skycell_id.pos"} = $ipprc->filename( "PPSUB.OUTPUT.SOURCES", $path_base );
+            $files{"$skycell_id.neg"} = $ipprc->filename( "PPSUB.INVERSE.SOURCES", $path_base ) if
+                defined $comp->{bothways} and $comp->{bothways};
+            $zp{"$skycell_id.pos"} = $comp->{zpt_obs};
+            $zp{"$skycell_id.neg"} = $comp->{zpt_obs};
+        } elsif ($stage eq 'camera') {
+            my $cam_id = $comp->{cam_id};
+            $files{$cam_id} = $ipprc->filename( "PSASTRO.OUTPUT", $path_base );
+            $zp{$cam_id} = $comp->{zpt_obs};
+        }
+    }
+}
+
+# Prepare for data store input
+my ($listFile, $listFileName) = tempfile("/tmp/publish.$pub_id.list.XXXX", UNLINK => !$save_temps );
+
+my $outroot = "$workdir/$product.$pub_id";
+
+# Process each file
+foreach my $comp ( keys %files ) {
+    my $file = $ipprc->file_resolve( $files{$comp} ) or
+        &my_die("Unable to resolve file $files{$comp}", $pub_id, $PS_EXIT_PROG_ERROR);
+    my_die("Unable to find file $file", $pub_id, $PS_EXIT_PROG_ERROR) unless $ipprc->file_exists( $file );
+
+    my $zp = $zp{$comp};
+    if ($product eq "IPP-MOPS") {
+        my $out = "$outroot.$comp.fits";
+
+        my $command = "$ppMops $file $zp $out";
+        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+            run(command => $command, verbose => $verbose);
+        &my_die( "Unable to translate $file", $pub_id, $PS_EXIT_SYS_ERROR) unless $success;
+        &my_die( "Unable to find translated file $out", $pub_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $out );
+        $file = $out;
+    }
+
+    # format: filename|filesize|md5sum|filetype|
+    # note: since we omit filesize and md5sum, dsreg will calculate them
+    print $listFile "$file|||$product|$comp|\n";
+}
+
+
+unless ($no_update) {
+    my $command = "$dsreg --add $stage.$stage_id --product $product --type $product --list $listFileName";
+
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+        run(command => $command, verbose => $verbose);
+    &my_die( "Unable to register with data store", $pub_id, $PS_EXIT_SYS_ERROR) unless $success;
+}
+
+unless ($no_update) {
+    my $command = "$pubtool -add -pub_id $pub_id -path_base $outroot";
+
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+        run(command => $command, verbose => $verbose);
+    &my_die( "Unable to register with data store", $pub_id, $PS_EXIT_SYS_ERROR) unless $success;
+}
+
+
+
+### Pau.
+
+
+sub my_die
+{
+    my $msg = shift;            # Exit message
+    my $pub_id = shift;         # Publish run identifier
+    my $fault = shift;          # Fault code
+
+    $fault = $PS_EXIT_PROG_ERROR unless defined $fault;
+
+    carp($msg);
+    if (defined $pub_id and not $no_update) {
+        my $command = "$pubtool -add";
+        $command .= " -pub_id $pub_id";
+        $command .= " -fault $fault";
+        $command .= " -dbname $dbname" if defined $dbname;
+
+        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+            run(command => $command, verbose => $verbose);
+    }
+    exit $fault;
+}
+
+
+__END__
Index: /branches/pap_mops/ippTools/doc/publish_flow.txt
===================================================================
--- /branches/pap_mops/ippTools/doc/publish_flow.txt	(revision 24426)
+++ /branches/pap_mops/ippTools/doc/publish_flow.txt	(revision 24427)
@@ -3,14 +3,12 @@
 
 ### Regularly run by pantasks to generate publishing runs based on data that has been processed
-pubtool -definerun
+pubtool -definerun -workdir /path/to/somewhere
 
 ### Regularly run by pantasks to get list of files to publish
 pubtool -pending
---> publish_file.pl --pub_id 12345 --component skycell.123.456 --destination DataStore --stage diff --stage_id 67890 --format MOPS
-----> pubtool -add -pub_id 12345 --component skycell.123.456 --fault 0
+--> publish_file.pl --pub_id 12345 --workdir /path/to/somewhere --product IPP-MOPS --stage diff --stage_id 67890
+----> pubtool -add -pub_id 12345 -path_base /path/to/somewherenice -fault 0
 
 ### Run as required
 pubtool -revert
 
-### Regularly run by pantasks to mark running publish runs as 'full'
-pubtool -advance
Index: /branches/pap_mops/ippTools/share/Makefile.am
===================================================================
--- /branches/pap_mops/ippTools/share/Makefile.am	(revision 24426)
+++ /branches/pap_mops/ippTools/share/Makefile.am	(revision 24427)
@@ -167,4 +167,7 @@
      pxadmin_create_mirror_tables.sql \
      pxadmin_drop_tables.sql \
+     pubtool_definerun.sql \
+     pubtool_pending.sql \
+     pubtool_revert.sql \
      pztool_find_completed_exp.sql \
      pztool_pendingimfile.sql \
Index: /branches/pap_mops/ippTools/share/difftool_skyfile.sql
===================================================================
--- /branches/pap_mops/ippTools/share/difftool_skyfile.sql	(revision 24426)
+++ /branches/pap_mops/ippTools/share/difftool_skyfile.sql	(revision 24427)
@@ -6,4 +6,8 @@
     diffRun.workdir,
     diffRun.bothways,
+    camProcessedExp.zpt_obs,
+    camProcessedExp.zpt_stdev,
+    camProcessedExp.zpt_lq,
+    camProcessedExp.zpt_uq,
     warp1,
     stack1,
@@ -14,7 +18,8 @@
 JOIN diffInputSkyfile USING(diff_id, skycell_id)
 JOIN warpRun
-    ON warpRun.warp_id = diffInputSkyfile.warp1
+    ON warpRun.warp_id = diffInputSkyfile.warp1 -- NOTE: joining input only!
 JOIN fakeRun USING(fake_id)
 JOIN camRun USING(cam_id)
+JOIN camProcessedExp USING(cam_id)
 JOIN chipRun USING(chip_id)
 JOIN rawExp USING(exp_id)
Index: anches/pap_mops/ippTools/share/pubtool_advance.sql
===================================================================
--- /branches/pap_mops/ippTools/share/pubtool_advance.sql	(revision 24426)
+++ 	(revision )
@@ -1,37 +1,0 @@
-UPDATE publishRun
-SET state = 'full'
-WHERE pub_id IN SELECT
-    pub_id
-FROM ((
-    -- Get number of files to do
-    SELECT
-        pub_id,
-        COUNT(*) AS num_todo
-    FROM publishRun
-    JOIN publishClient USING(client_id)
-    JOIN diffRun
-        ON diffRun.diff_id = publishRun.stage_id
-    JOIN diffSkyfile USING(diff_id)
-    WHERE publishClient.stage = 'diff'
-    GROUP BY pub_id
-    ) AS publishDiffs UNION (
-    SELECT
-        pub_id,
-        1 AS num_todo
-    FROM publishRun
-    JOIN publishClient USING(client_id)
-    WHERE publishClient.stage = 'camera'
-    ) AS publishDiffs
-) AS publishToDo
-JOIN (
-    -- Get number of files done
-    SELECT
-        pub_id,
-        COUNT(*) AS num_done
-    FROM publishRun
-    JOIN publishFile USING(pub_id)
-    WHERE publishFile.fault = 0
-    GROUP BY pub_id
-    ) AS publishDone USING(pub_id)
-WHERE num_todo = num_done
-
Index: /branches/pap_mops/ippTools/share/pubtool_pending.sql
===================================================================
--- /branches/pap_mops/ippTools/share/pubtool_pending.sql	(revision 24426)
+++ /branches/pap_mops/ippTools/share/pubtool_pending.sql	(revision 24427)
@@ -1,16 +1,11 @@
 SELECT
-    publishRun.pub_id,
-    publishRun.stage_id,
-    publishClient.destination,
-    publishClient.stage,
-    publishClient.format,
-    publishToDo.component
-FROM publishRun
-JOIN publishClient USING(client_id)
-JOIN ((
+    publishToDo.*
+FROM ((
     SELECT
-        pub_id,
-        diff_id AS stage_id,
-        skycell_id AS component
+        publishRun.pub_id,
+        publishClient.product,
+        publishClient.stage,
+        diffRun.diff_id AS stage_id,
+        publishRun.workdir
     FROM publishRun
     JOIN publishClient USING(client_id)
@@ -19,9 +14,13 @@
     JOIN diffSkyfile USING(diff_id)
     WHERE publishClient.stage = 'diff'
+        AND publishRun.state = 'new'
+        AND diffRun.state = 'full'
     ) AS publishDiffs UNION (
     SELECT
-        pub_id,
-        cam_id AS stage_id,
-        NULL AS component
+        publishRun.pub_id,
+        publishClient.product,
+        publishClient.stage,
+        camRun.cam_id AS stage_id,
+        publishRun.workdir
     FROM publishRun
     JOIN publishClient USING(client_id)
@@ -29,7 +28,8 @@
         ON camRun.cam_id = publishRun.stage_id
     WHERE publishClient.stage = 'camera'
+        AND publishRun.state ='new'
+        AND camRun.state = 'full'
     ) AS publishCams
-) AS publishToDo USING(pub_id, stage_id)
-LEFT JOIN publishFile USING(pub_id, component)
-WHERE publishRun.state = 'new'
-    AND publishFile.pub_id IS NULL
+) AS publishToDo
+LEFT JOIN publishDone USING(pub_id)
+WHERE publishDone.pub_id IS NULL
Index: /branches/pap_mops/ippTools/share/pubtool_revert.sql
===================================================================
--- /branches/pap_mops/ippTools/share/pubtool_revert.sql	(revision 24426)
+++ /branches/pap_mops/ippTools/share/pubtool_revert.sql	(revision 24427)
@@ -1,5 +1,5 @@
-DELETE FROM publishFile
-USING publishFile, publishRun, publishClient
-WHERE publishFile.pub_id = publishRun.pub_id
+DELETE FROM publishDone
+USING publishDone, publishRun, publishClient
+WHERE publishDone.pub_id = publishRun.pub_id
     AND publishRun.client_id = publishClient.client_id
-    AND receiveResult.fault != 0
+    AND publishDone.fault != 0
Index: /branches/pap_mops/ippTools/share/pxadmin_create_tables.sql
===================================================================
--- /branches/pap_mops/ippTools/share/pxadmin_create_tables.sql	(revision 24426)
+++ /branches/pap_mops/ippTools/share/pxadmin_create_tables.sql	(revision 24427)
@@ -1374,8 +1374,7 @@
 CREATE TABLE publishClient (
     client_id BIGINT AUTO_INCREMENT, -- unique identifier
+    product VARCHAR(64),             -- product name
+    stage VARCHAR(64) NOT NULL, -- stage of interest (chip, camera, diff, etc.)
     comment VARCHAR(255),            -- for human memory
-    stage VARCHAR(64) NOT NULL, -- stage of interest (chip, camera, diff, etc.)
-    format VARCHAR(64),              -- format of data
-    destination VARCHAR(255) NOT NULL, -- where to send data
     PRIMARY KEY(client_id)
 ) ENGINE=innodb DEFAULT CHARSET=latin1;
@@ -1386,4 +1385,5 @@
     client_id BIGINT NOT NULL,  -- link to publishClient
     stage_id BIGINT NOT NULL,   -- link to various stage tables
+    workdir VARCHAR(255) NOT NULL, -- working directory
     label VARCHAR(64),          -- label for run
     state VARCHAR(64),          -- state of run (new, full, etc.)
@@ -1397,10 +1397,9 @@
 
 -- Publishing a file within a set
-CREATE TABLE publishFile (
+CREATE TABLE publishDone (
     pub_id BIGINT AUTO_INCREMENT, -- link to publishRun
-    component VARCHAR(64),        -- analagous to class_id or skycell_id
+    path_base VARCHAR(255),     -- base path of output
     fault SMALLINT NOT NULL DEFAULT 0, -- Fault code
-    PRIMARY KEY(pub_id, component),
-    KEY(component),
+    PRIMARY KEY(pub_id),
     KEY(fault),
     FOREIGN KEY(pub_id) REFERENCES publishRun(pub_id)
Index: /branches/pap_mops/ippTools/src/pubtool.c
===================================================================
--- /branches/pap_mops/ippTools/src/pubtool.c	(revision 24426)
+++ /branches/pap_mops/ippTools/src/pubtool.c	(revision 24427)
@@ -36,5 +36,4 @@
 static bool addMode(pxConfig *config);
 static bool revertMode(pxConfig *config);
-static bool advanceMode(pxConfig *config);
 
 # define MODECASE(caseName, func) \
@@ -62,5 +61,4 @@
         MODECASE(PUBTOOL_MODE_ADD, addMode);
         MODECASE(PUBTOOL_MODE_REVERT, revertMode);
-        MODECASE(PUBTOOL_MODE_ADVANCE, advanceMode);
       default:
         psAbort("invalid option (this should not happen)");
@@ -89,12 +87,11 @@
 
     // required
+    PXOPT_LOOKUP_STR(product, config->args, "-product",  true, false);
     PXOPT_LOOKUP_STR(stage, config->args, "-stage", true, false);
-    PXOPT_LOOKUP_STR(destination, config->args, "-destination",  true, false);
 
     // optional
-    PXOPT_LOOKUP_STR(format, config->args, "-format",  false, false);
     PXOPT_LOOKUP_STR(comment, config->args, "-comment",  false, false);
 
-    if (!publishClientInsert(config->dbh, 0, stage, destination, format, comment)) {
+    if (!publishClientInsert(config->dbh, 0, product, stage, comment)) {
         psError(PS_ERR_UNKNOWN, false, "Database error");
         return false;
@@ -109,4 +106,7 @@
 
     psMetadata *where = psMetadataAlloc(); // WHERE conditions
+
+    // required
+    PXOPT_LOOKUP_STR(workdir, config->args, "-workdir",  true, false);
 
     // optional
@@ -141,5 +141,5 @@
         psFree(query);
         psFree(whereClause);
-        if (!psDBTransaction(config->dbh)) {
+        if (!psDBRollback(config->dbh)) {
             psError(PS_ERR_UNKNOWN, false, "Database error");
         }
@@ -152,5 +152,5 @@
     if (!output) {
         psError(PS_ERR_UNKNOWN, false, "Database error");
-        if (!psDBTransaction(config->dbh)) {
+        if (!psDBRollback(config->dbh)) {
             psError(PS_ERR_UNKNOWN, false, "Database error");
         }
@@ -160,5 +160,5 @@
         psTrace("pubtool", PS_LOG_INFO, "No rows found");
         psFree(output);
-        if (!psDBTransaction(config->dbh)) {
+        if (!psDBRollback(config->dbh)) {
             psError(PS_ERR_UNKNOWN, false, "Database error");
         }
@@ -171,8 +171,8 @@
         psS64 stage = psMetadataLookupS64(NULL, row, "stage_id");   // Stage identifier
 
-        if (!publishRunInsert(config->dbh, 0, client, stage, set_label, "new")) {
+        if (!publishRunInsert(config->dbh, 0, client, stage, workdir, set_label, "new")) {
             psError(PS_ERR_UNKNOWN, false, "Unable to add fileset");
             psFree(output);
-            if (!psDBTransaction(config->dbh)) {
+            if (!psDBRollback(config->dbh)) {
                 psError(PS_ERR_UNKNOWN, false, "Database error");
             }
@@ -182,5 +182,5 @@
     psFree(output);
 
-    if (!psDBTransaction(config->dbh)) {
+    if (!psDBCommit(config->dbh)) {
         psError(PS_ERR_UNKNOWN, false, "Database error");
         return false;
@@ -259,11 +259,34 @@
     // required
     PXOPT_LOOKUP_S64(pub_id, config->args, "-pub_id", true, false);
-    PXOPT_LOOKUP_STR(component, config->args, "-component", true, false);
+    PXOPT_LOOKUP_STR(path_base, config->args, "-path_base",  true, false);
 
     // optional
     PXOPT_LOOKUP_S32(fault, config->args, "-fault", false, false);
 
-    if (!publishFileInsert(config->dbh, pub_id, component, fault)) {
+    if (!psDBTransaction(config->dbh)) {
+        psError(PS_ERR_UNKNOWN, false, "Database error");
+        return false;
+    }
+
+    if (!publishDoneInsert(config->dbh, pub_id, path_base, fault)) {
         psError(PS_ERR_UNKNOWN, false, "Unable to add file");
+        if (!psDBRollback(config->dbh)) {
+            psError(PS_ERR_UNKNOWN, false, "Database error");
+        }
+        return false;
+    }
+
+    if (!p_psDBRunQueryF(config->dbh,
+                         "UPDATE publishRun SET state = 'full' WHERE pub_id = %" PRId64,
+                         pub_id)) {
+        psError(PS_ERR_UNKNOWN, false, "Database error");
+        if (!psDBRollback(config->dbh)) {
+            psError(PS_ERR_UNKNOWN, false, "Database error");
+        }
+        return false;
+    }
+
+    if (!psDBCommit(config->dbh)) {
+        psError(PS_ERR_UNKNOWN, false, "Database error");
         return false;
     }
@@ -283,5 +306,4 @@
     PXOPT_COPY_S32(config->args, where, "-fault", "fault", "==");
     PXOPT_COPY_STR(config->args, where, "-client_id", "client_id", "==");
-    PXOPT_COPY_STR(config->args, where, "-component", "component", "==");
     PXOPT_COPY_STR(config->args, where, "-comment", "comment", "LIKE");
     PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
@@ -310,21 +332,3 @@
     return true;
 }
-static bool advanceMode(pxConfig *config)
-{
-    PS_ASSERT_PTR_NON_NULL(config, false);
-
-    psString query = pxDataGet("pubtool_advance.sql");
-    if (!query) {
-        psError(PXTOOLS_ERR_DATA, false, "Failed to retreive SQL statement");
-        return false;
-    }
-
-    if (!p_psDBRunQuery(config->dbh, query)) {
-        psError(PS_ERR_UNKNOWN, false, "Database error");
-        psFree(query);
-        return false;
-    }
-    psFree(query);
-
-    return true;
-}
+
Index: /branches/pap_mops/ippTools/src/pubtool.h
===================================================================
--- /branches/pap_mops/ippTools/src/pubtool.h	(revision 24426)
+++ /branches/pap_mops/ippTools/src/pubtool.h	(revision 24427)
@@ -30,5 +30,4 @@
     PUBTOOL_MODE_ADD,
     PUBTOOL_MODE_REVERT,
-    PUBTOOL_MODE_ADVANCE,
 } pubtoolMode;
 
Index: /branches/pap_mops/ippTools/src/pubtoolConfig.c
===================================================================
--- /branches/pap_mops/ippTools/src/pubtoolConfig.c	(revision 24426)
+++ /branches/pap_mops/ippTools/src/pubtoolConfig.c	(revision 24427)
@@ -46,10 +46,10 @@
     psMetadata *defineclientArgs = psMetadataAlloc();
     psMetadataAddStr(defineclientArgs, PS_LIST_TAIL, "-stage", 0, "define stage (required)", NULL);
-    psMetadataAddStr(defineclientArgs, PS_LIST_TAIL, "-destination", 0, "define destination (required)", NULL);
-    psMetadataAddStr(defineclientArgs, PS_LIST_TAIL, "-format", 0, "define format", NULL);
+    psMetadataAddStr(defineclientArgs, PS_LIST_TAIL, "-product", 0, "define product (required)", NULL);
     psMetadataAddStr(defineclientArgs, PS_LIST_TAIL, "-comment", 0, "define comment", NULL);
 
     // -definerun
     psMetadata *definerunArgs = psMetadataAlloc();
+    psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-workdir", 0, "define workdir (required)", NULL);
     psMetadataAddS64(definerunArgs, PS_LIST_TAIL, "-set_label", 0, "define label", 0);
     psMetadataAddS64(definerunArgs, PS_LIST_TAIL, "-client_id", 0, "search by client_id", 0);
@@ -68,5 +68,4 @@
     psMetadata *addArgs = psMetadataAlloc();
     psMetadataAddS64(addArgs, PS_LIST_TAIL, "-pub_id", 0, "define pub_id (required)", 0);
-    psMetadataAddStr(addArgs, PS_LIST_TAIL, "-component", 0, "define component (required)", NULL);
     psMetadataAddS32(addArgs, PS_LIST_TAIL, "-fault", 0, "define fault code", 0);
 
@@ -74,5 +73,4 @@
     psMetadata *revertArgs = psMetadataAlloc();
     psMetadataAddS64(revertArgs, PS_LIST_TAIL, "-pub_id", 0, "search on pub_id", 0);
-    psMetadataAddStr(revertArgs, PS_LIST_TAIL, "-component", 0, "search on component", NULL);
     psMetadataAddS32(revertArgs, PS_LIST_TAIL, "-fault", 0, "search on fault code", 0);
     psMetadataAddStr(revertArgs, PS_LIST_TAIL, "-client_id", 0, "search on client_id", NULL);
@@ -80,6 +78,4 @@
     psMetadataAddStr(revertArgs, PS_LIST_TAIL, "-label", 0, "search on label", NULL);
 
-    // -advance
-    psMetadata *advanceArgs = psMetadataAlloc();
 
     psMetadata *argSets = psMetadataAlloc();
@@ -91,5 +87,4 @@
     PXOPT_ADD_MODE("-add", "", PUBTOOL_MODE_ADD, addArgs);
     PXOPT_ADD_MODE("-revert", "", PUBTOOL_MODE_REVERT, revertArgs);
-    PXOPT_ADD_MODE("-advance", "", PUBTOOL_MODE_ADVANCE, advanceArgs);
 
     if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) {
